Skip to content

Commit 089f51a

Browse files
Gustedearl-warren
authored andcommitted
[DEADCODE] Add deadcode linter
- Add the experimental [deacode](https://pkg.go.dev/golang.org/x/tools/internal/cmd/deadcode) linter to Forgejo. - To deal with false positives that can happen due to build tags or with code that's currently only referenced by test code, the output of the tool is compared against a known-good output. - This commit doesn't make any attempt to remove any deadcode. (cherry picked from commit ac462279e9361070326d512fc209b6f148f27865) (cherry picked from commit b5ea6e85acecb8c02d18d51ec489bb1d329a33ce) (cherry picked from commit 5915f3643c1939ab09dcac8f9fcb74bd4231a16d) [CLEANUP] Remove deadcode - This is deadcode since https://codeberg.org/forgejo/forgejo/pulls/1802 removed the usage of it. (cherry picked from commit d840b9923e1a7aad7306c6b4d02df771ed0f40f4) (cherry picked from commit 9442bab6266807141a14a647d3bc383233fc56e9) (cherry picked from commit 0de9d18863c6af44941c7021548cdb07173ba3c0) (cherry picked from commit 26abf783746ef29e66eea966160e2f9c139add26) (cherry picked from commit 05d3a143c3785f3cc5e7f561aa2ad2ba556b55cc) (cherry picked from commit 4b3d38d) (cherry picked from commit a726e7198613b330a58c8c6dfc8866c360fbe555) (cherry picked from commit cb62ae5b9885bcd5c2b6cb60f0e9cce6a991cc3c) (cherry picked from commit 8195ba06d52fc1a05e9907149bb441b66887870e) (cherry picked from commit 4570fb591aac0359a36800c8cadcd71613bdc7df) (cherry picked from commit 1f4d33de2b68c776a305fe38fe6be5ae510ce983)
1 parent c7a389f commit 089f51a

File tree

5 files changed

+376
-73
lines changed

5 files changed

+376
-73
lines changed

.deadcode-out

Lines changed: 366 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,366 @@
1+
package "code.gitea.io/gitea/cmd"
2+
func NoMainListener
3+
4+
package "code.gitea.io/gitea/cmd/forgejo"
5+
func ContextSetNoInit
6+
func ContextSetNoExit
7+
func ContextSetStderr
8+
func ContextGetStderr
9+
func ContextSetStdout
10+
func ContextSetStdin
11+
12+
package "code.gitea.io/gitea/models"
13+
func IsErrUpdateTaskNotExist
14+
func (ErrUpdateTaskNotExist).Error
15+
func (ErrUpdateTaskNotExist).Unwrap
16+
func IsErrSHANotFound
17+
func GetYamlFixturesAccess
18+
19+
package "code.gitea.io/gitea/models/actions"
20+
func ListUploadedArtifactsByRunID
21+
func CountRunJobs
22+
func (ScheduleList).GetUserIDs
23+
func (ScheduleList).GetRepoIDs
24+
func (ScheduleList).LoadTriggerUser
25+
func (ScheduleList).LoadRepos
26+
func FindSchedules
27+
func CountSpecs
28+
func GetVariableByID
29+
30+
package "code.gitea.io/gitea/models/asymkey"
31+
func HasDeployKey
32+
33+
package "code.gitea.io/gitea/models/auth"
34+
func DeleteAuthTokenByID
35+
func GetSourceByName
36+
func GetWebAuthnCredentialByID
37+
func WebAuthnCredentials
38+
39+
package "code.gitea.io/gitea/models/db"
40+
func TruncateBeans
41+
func InTransaction
42+
func DumpTables
43+
func Count
44+
func FindAndCount
45+
46+
package "code.gitea.io/gitea/models/dbfs"
47+
func (*file).renameTo
48+
func Create
49+
func Rename
50+
51+
package "code.gitea.io/gitea/models/forgejo/semver"
52+
func GetVersion
53+
func SetVersionString
54+
func SetVersion
55+
56+
package "code.gitea.io/gitea/models/forgejo_migrations"
57+
func GetCurrentDBVersion
58+
func EnsureUpToDate
59+
60+
package "code.gitea.io/gitea/models/git"
61+
func RemoveDeletedBranchByID
62+
63+
package "code.gitea.io/gitea/models/issues"
64+
func IsErrUnknownDependencyType
65+
func (ErrNewIssueInsert).Error
66+
func IsErrIssueWasClosed
67+
func GetIssueWithAttrsByID
68+
func GetRepoIDsForIssuesOptions
69+
func GetLabelIDsInOrgByNames
70+
func ChangeMilestoneStatus
71+
func GetMilestonesByRepoIDs
72+
func CountMilestonesByRepoCond
73+
func GetMilestonesStatsByRepoCond
74+
func IsErrErrPullRequestHeadRepoMissing
75+
func (ErrPullRequestHeadRepoMissing).Error
76+
func GetPullRequestsByHeadBranch
77+
func (ErrIssueStopwatchAlreadyExist).Error
78+
func (ErrIssueStopwatchAlreadyExist).Unwrap
79+
80+
package "code.gitea.io/gitea/models/migrations/base"
81+
func removeAllWithRetry
82+
func newXORMEngine
83+
func deleteDB
84+
func PrepareTestEnv
85+
func MainTest
86+
87+
package "code.gitea.io/gitea/models/organization"
88+
func UpdateTeamUnits
89+
func (SearchMembersOptions).ToConds
90+
func UsersInTeamsCount
91+
92+
package "code.gitea.io/gitea/models/packages/alpine"
93+
func GetBranches
94+
func GetRepositories
95+
func GetArchitectures
96+
97+
package "code.gitea.io/gitea/models/perm/access"
98+
func GetRepoWriters
99+
100+
package "code.gitea.io/gitea/models/project"
101+
func UpdateBoardSorting
102+
func ChangeProjectStatus
103+
104+
package "code.gitea.io/gitea/models/repo"
105+
func DeleteAttachmentsByIssue
106+
func (*releaseSorter).Len
107+
func (*releaseSorter).Less
108+
func (*releaseSorter).Swap
109+
func SortReleases
110+
func (SearchOrderBy).String
111+
func IsErrTopicNotExist
112+
func (ErrTopicNotExist).Error
113+
func (ErrTopicNotExist).Unwrap
114+
func GetTopicByName
115+
func WatchRepoMode
116+
117+
package "code.gitea.io/gitea/models/system"
118+
func DeleteNotice
119+
120+
package "code.gitea.io/gitea/models/unittest"
121+
func CheckConsistencyFor
122+
func checkForConsistency
123+
func GetXORMEngine
124+
func OverrideFixtures
125+
func InitFixtures
126+
func LoadFixtures
127+
func Copy
128+
func CopyDir
129+
func FixturesDir
130+
func fatalTestError
131+
func InitSettings
132+
func MainTest
133+
func CreateTestEngine
134+
func PrepareTestDatabase
135+
func PrepareTestEnv
136+
func Cond
137+
func OrderBy
138+
func LoadBeanIfExists
139+
func BeanExists
140+
func AssertExistsAndLoadBean
141+
func GetCount
142+
func AssertNotExistsBean
143+
func AssertExistsIf
144+
func AssertSuccessfulInsert
145+
func AssertCount
146+
func AssertInt64InRange
147+
148+
package "code.gitea.io/gitea/models/user"
149+
func IsErrPrimaryEmailCannotDelete
150+
func (ErrUserInactive).Error
151+
func (ErrUserInactive).Unwrap
152+
func IsErrExternalLoginUserAlreadyExist
153+
func IsErrExternalLoginUserNotExist
154+
func IsErrUserSettingIsNotExist
155+
func GetUserAllSettings
156+
func DeleteUserSetting
157+
func GetUserEmailsByNames
158+
159+
package "code.gitea.io/gitea/modules/activitypub"
160+
func CurrentTime
161+
func containsRequiredHTTPHeaders
162+
func NewClient
163+
func (*Client).NewRequest
164+
func (*Client).Post
165+
func GetPrivateKey
166+
167+
package "code.gitea.io/gitea/modules/assetfs"
168+
func Bindata
169+
170+
package "code.gitea.io/gitea/modules/auth/password/hash"
171+
func (*DummyHasher).HashWithSaltBytes
172+
func NewDummyHasher
173+
174+
package "code.gitea.io/gitea/modules/auth/password/pwn"
175+
func WithHTTP
176+
177+
package "code.gitea.io/gitea/modules/base"
178+
func BasicAuthEncode
179+
func IsLetter
180+
func SetupGiteaRoot
181+
182+
package "code.gitea.io/gitea/modules/cache"
183+
func GetInt
184+
func WithNoCacheContext
185+
func RemoveContextData
186+
187+
package "code.gitea.io/gitea/modules/charset"
188+
func (*BreakWriter).Write
189+
func ToUTF8
190+
func EscapeControlString
191+
192+
package "code.gitea.io/gitea/modules/context"
193+
func GetPrivateContext
194+
195+
package "code.gitea.io/gitea/modules/emoji"
196+
func ReplaceCodes
197+
198+
package "code.gitea.io/gitea/modules/eventsource"
199+
func (*Event).String
200+
201+
package "code.gitea.io/gitea/modules/git"
202+
func AllowLFSFiltersArgs
203+
func AddChanges
204+
func AddChangesWithArgs
205+
func CommitChanges
206+
func CommitChangesWithArgs
207+
func IsErrExecTimeout
208+
func (ErrExecTimeout).Error
209+
func (ErrUnsupportedVersion).Error
210+
func SetUpdateHook
211+
func openRepositoryWithDefaultContext
212+
func GetBranchCommitID
213+
func IsTagExist
214+
func ToEntryMode
215+
func (*LimitedReaderCloser).Read
216+
func (*LimitedReaderCloser).Close
217+
218+
package "code.gitea.io/gitea/modules/gitgraph"
219+
func (*Parser).Reset
220+
221+
package "code.gitea.io/gitea/modules/graceful"
222+
func (*Manager).TerminateContext
223+
func (*Manager).IsTerminate
224+
func (*Manager).Err
225+
func (*Manager).Value
226+
func (*Manager).Deadline
227+
228+
package "code.gitea.io/gitea/modules/hcaptcha"
229+
func WithHTTP
230+
231+
package "code.gitea.io/gitea/modules/json"
232+
func (StdJSON).Marshal
233+
func (StdJSON).Unmarshal
234+
func (StdJSON).NewEncoder
235+
func (StdJSON).NewDecoder
236+
func (StdJSON).Indent
237+
238+
package "code.gitea.io/gitea/modules/markup"
239+
func GetRendererByType
240+
func RenderString
241+
func IsMarkupFile
242+
243+
package "code.gitea.io/gitea/modules/markup/console"
244+
func Render
245+
func RenderString
246+
247+
package "code.gitea.io/gitea/modules/markup/markdown"
248+
func IsDetails
249+
func IsSummary
250+
func IsTaskCheckBoxListItem
251+
func IsIcon
252+
func IsColorPreview
253+
func RenderRawString
254+
255+
package "code.gitea.io/gitea/modules/markup/markdown/math"
256+
func WithInlineDollarParser
257+
func WithBlockDollarParser
258+
259+
package "code.gitea.io/gitea/modules/markup/mdstripper"
260+
func StripMarkdown
261+
262+
package "code.gitea.io/gitea/modules/markup/orgmode"
263+
func RenderString
264+
265+
package "code.gitea.io/gitea/modules/private"
266+
func ActionsRunnerRegister
267+
268+
package "code.gitea.io/gitea/modules/process"
269+
func (*Manager).ExecTimeout
270+
271+
package "code.gitea.io/gitea/modules/queue"
272+
func newBaseChannelSimple
273+
func newBaseChannelUnique
274+
func newBaseRedisSimple
275+
func newBaseRedisUnique
276+
func newWorkerPoolQueueForTest
277+
278+
package "code.gitea.io/gitea/modules/queue/lqinternal"
279+
func QueueItemIDBytes
280+
func QueueItemKeyBytes
281+
func ListLevelQueueKeys
282+
283+
package "code.gitea.io/gitea/modules/setting"
284+
func NewConfigProviderFromData
285+
func (*GitConfigType).GetOption
286+
func InitLoggersForTest
287+
288+
package "code.gitea.io/gitea/modules/storage"
289+
func (ErrInvalidConfiguration).Error
290+
func IsErrInvalidConfiguration
291+
292+
package "code.gitea.io/gitea/modules/structs"
293+
func ParseCreateHook
294+
func ParsePushHook
295+
296+
package "code.gitea.io/gitea/modules/sync"
297+
func (*StatusTable).Start
298+
func (*StatusTable).IsRunning
299+
300+
package "code.gitea.io/gitea/modules/testlogger"
301+
func (*testLoggerWriterCloser).pushT
302+
func (*testLoggerWriterCloser).Write
303+
func (*testLoggerWriterCloser).popT
304+
func (*testLoggerWriterCloser).Close
305+
func (*testLoggerWriterCloser).Reset
306+
func PrintCurrentTest
307+
func Printf
308+
func NewTestLoggerWriter
309+
310+
package "code.gitea.io/gitea/modules/timeutil"
311+
func GetExecutableModTime
312+
func Set
313+
func Unset
314+
315+
package "code.gitea.io/gitea/modules/translation"
316+
func (MockLocale).Language
317+
func (MockLocale).Tr
318+
func (MockLocale).TrN
319+
func (MockLocale).PrettyNumber
320+
321+
package "code.gitea.io/gitea/modules/util/filebuffer"
322+
func CreateFromReader
323+
324+
package "code.gitea.io/gitea/modules/web"
325+
func RouteMock
326+
func RouteMockReset
327+
328+
package "code.gitea.io/gitea/modules/web/middleware"
329+
func DeleteLocaleCookie
330+
331+
package "code.gitea.io/gitea/routers/web"
332+
func NotFound
333+
334+
package "code.gitea.io/gitea/routers/web/org"
335+
func MustEnableProjects
336+
func getActionIssues
337+
func UpdateIssueProject
338+
339+
package "code.gitea.io/gitea/services/convert"
340+
func ToSecret
341+
342+
package "code.gitea.io/gitea/services/forms"
343+
func (*DeadlineForm).Validate
344+
345+
package "code.gitea.io/gitea/services/packages/alpine"
346+
func BuildAllRepositoryFiles
347+
348+
package "code.gitea.io/gitea/services/pull"
349+
func IsCommitStatusContextSuccess
350+
351+
package "code.gitea.io/gitea/services/repository"
352+
func GetBranchCommitID
353+
func IsErrForkAlreadyExist
354+
355+
package "code.gitea.io/gitea/services/repository/archiver"
356+
func ArchiveRepository
357+
358+
package "code.gitea.io/gitea/services/repository/files"
359+
func (*ContentType).String
360+
func GetFileResponseFromCommit
361+
func (*TemporaryUploadRepository).GetLastCommit
362+
func (*TemporaryUploadRepository).GetLastCommitByRef
363+
364+
package "code.gitea.io/gitea/services/webhook"
365+
func NewNotifier
366+

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ cpu.out
9797
/VERSION
9898
/.air
9999
/.go-licenses
100+
/.cur-deadcode-out
100101

101102
# Snapcraft
102103
/gitea_a*.txt

0 commit comments

Comments
 (0)