Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 699508
Collapse All | Expand All

(-)a/repoman/cnf/linechecks/linechecks.yaml (-23 / +23 lines)
Lines 9-35 repoman_version: 2.3.3 Link Here
9
# configuration file for the LineCheck plugins run via the multicheck
9
# configuration file for the LineCheck plugins run via the multicheck
10
# scan module
10
# scan module
11
errors:
11
errors:
12
    COPYRIGHT_ERROR: 'Invalid Copyright on line: %d'
12
    COPYRIGHT_ERROR: 'Invalid Copyright'
13
    LICENSE_ERROR: 'Invalid Gentoo/GPL License on line: %d'
13
    LICENSE_ERROR: 'Invalid Gentoo/GPL License'
14
    ID_HEADER_ERROR: 'Stale CVS header on line: %d'
14
    ID_HEADER_ERROR: 'Stale CVS header'
15
    NO_BLANK_LINE_ERROR: 'Non-blank line after header on line: %d'
15
    NO_BLANK_LINE_ERROR: 'Non-blank line after header'
16
    LEADING_SPACES_ERROR: 'Ebuild contains leading spaces on line: %d'
16
    LEADING_SPACES_ERROR: 'Ebuild contains leading spaces'
17
    TRAILING_WHITESPACE_ERROR: 'Trailing whitespace error on line: %d'
17
    TRAILING_WHITESPACE_ERROR: 'Trailing whitespace error'
18
    READONLY_ASSIGNMENT_ERROR: 'Ebuild contains assignment to read-only variable on line: %d'
18
    READONLY_ASSIGNMENT_ERROR: 'Ebuild contains assignment to read-only variable'
19
    MISSING_QUOTES_ERROR: 'Unquoted Variable on line: %d'
19
    MISSING_QUOTES_ERROR: 'Unquoted Variable'
20
    NESTED_DIE_ERROR: 'Ebuild calls die in a subshell on line: %d'
20
    NESTED_DIE_ERROR: 'Ebuild calls die in a subshell'
21
    PATCHES_ERROR: 'PATCHES is not a bash array on line: %d'
21
    PATCHES_ERROR: 'PATCHES is not a bash array'
22
    REDUNDANT_CD_S_ERROR: 'Ebuild has redundant cd ${S} statement on line: %d'
22
    REDUNDANT_CD_S_ERROR: 'Ebuild has redundant cd ${S} statement'
23
    EMAKE_PARALLEL_DISABLED: 'Upstream parallel compilation bug (ebuild calls emake -j1 on line: %d)'
23
    EMAKE_PARALLEL_DISABLED: 'Upstream parallel compilation bug (ebuild calls emake -j1)'
24
    EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS: 'Upstream parallel compilation bug (MAKEOPTS=-j1 on line: %d)'
24
    EMAKE_PARALLEL_DISABLED_VIA_MAKEOPTS: 'Upstream parallel compilation bug (MAKEOPTS=-j1)'
25
    DEPRECATED_BINDNOW_FLAGS: 'Deprecated bindnow-flags call on line: %d'
25
    DEPRECATED_BINDNOW_FLAGS: 'Deprecated bindnow-flags call'
26
    EAPI_DEFINED_AFTER_INHERIT: 'EAPI defined after inherit on line: %d'
26
    EAPI_DEFINED_AFTER_INHERIT: 'EAPI defined after inherit'
27
    NO_AS_NEEDED: 'Upstream asneeded linking bug (no-as-needed on line: %d)'
27
    NO_AS_NEEDED: 'Upstream asneeded linking bug (no-as-needed)'
28
    PRESERVE_OLD_LIB: 'Ebuild calls deprecated preserve_old_lib on line: %d'
28
    PRESERVE_OLD_LIB: 'Ebuild calls deprecated preserve_old_lib'
29
    BUILT_WITH_USE: 'built_with_use on line: %d'
29
    BUILT_WITH_USE: 'built_with_use'
30
    NO_OFFSET_WITH_HELPERS: 'Helper function is used with D, ROOT, ED, EROOT or EPREFIX on line: %d'
30
    NO_OFFSET_WITH_HELPERS: 'Helper function is used with D, ROOT, ED, EROOT or EPREFIX'
31
    SANDBOX_ADDPREDICT: 'Ebuild calls addpredict on line: %d'
31
    SANDBOX_ADDPREDICT: 'Ebuild calls addpredict'
32
    USEQ_ERROR: 'Ebuild calls deprecated useq function on line: %d'
32
    USEQ_ERROR: 'Ebuild calls deprecated useq function'
33
    HASQ_ERROR: 'Ebuild calls deprecated hasq function on line: %d'
33
    HASQ_ERROR: 'Ebuild calls deprecated hasq function'
34
    URI_HTTPS: 'Ebuild uses http:// but should use https:// on line: %d'
34
    URI_HTTPS: 'Ebuild uses http:// but should use https://'
35
35
(-)a/repoman/lib/repoman/modules/linechecks/base.py (-3 / +2 lines)
Lines 88-96 class InheritEclass(LineCheck): Link Here
88
				if eapi_func is None or not eapi_func(self._eapi):
88
				if eapi_func is None or not eapi_func(self._eapi):
89
					self._func_call = True
89
					self._func_call = True
90
					return (
90
					return (
91
						'%s.eclass is not inherited, '
91
						'%s.eclass not inherited, but "%s" called' %
92
						'but "%s" found at line: %s' %
92
						(self._eclass, func_name))
93
						(self._eclass, func_name, '%d'))
94
		elif not self._func_call:
93
		elif not self._func_call:
95
			self._func_call = self._func_re.search(line)
94
			self._func_call = self._func_re.search(line)
96
95
(-)a/repoman/lib/repoman/modules/linechecks/controller.py (-4 / +8 lines)
Lines 74-80 class LineCheckController(object): Link Here
74
	def run_checks(self, contents, pkg):
74
	def run_checks(self, contents, pkg):
75
		'''Run the configured linechecks
75
		'''Run the configured linechecks
76
76
77
		@param contents: the ebjuild contents to check
77
		@param contents: the ebuild contents to check
78
		@param pkg: the package being checked
78
		@param pkg: the package being checked
79
		'''
79
		'''
80
		if self._constant_checks is None:
80
		if self._constant_checks is None:
Lines 134-142 class LineCheckController(object): Link Here
134
					if lc.check_eapi(pkg.eapi):
134
					if lc.check_eapi(pkg.eapi):
135
						ignore = lc.ignore_line
135
						ignore = lc.ignore_line
136
						if not ignore or not ignore.match(line):
136
						if not ignore or not ignore.match(line):
137
							e = lc.check(num, line)
137
							errors = lc.check(num, line)
138
							if e:
138
							if errors:
139
								yield lc.repoman_check_name, e % (num + 1)
139
								if isinstance(errors, (tuple, list)):
140
									for error in errors:
141
										yield lc.repoman_check_name, "line %d: %s" % (num + 1, error)
142
								else:
143
									yield lc.repoman_check_name, "line %d: %s" % (num + 1, errors)
140
144
141
		for lc in checks:
145
		for lc in checks:
142
			i = lc.end()
146
			i = lc.end()
(-)a/repoman/lib/repoman/modules/linechecks/deprecated/inherit.py (-12 / +6 lines)
Lines 37-45 class InheritDeprecated(LineCheck): Link Here
37
37
38
	_inherit_re = re.compile(r'^\s*inherit\s(.*)$')
38
	_inherit_re = re.compile(r'^\s*inherit\s(.*)$')
39
39
40
	def new(self, pkg):
41
		self._errors = []
42
43
	def check(self, num, line):
40
	def check(self, num, line):
44
		direct_inherits = None
41
		direct_inherits = None
45
		m = self._inherit_re.match(line)
42
		m = self._inherit_re.match(line)
Lines 51-70 class InheritDeprecated(LineCheck): Link Here
51
		if not direct_inherits:
48
		if not direct_inherits:
52
			return
49
			return
53
50
51
		errors = []
54
		for eclass in direct_inherits:
52
		for eclass in direct_inherits:
55
			replacement = self.deprecated_eclasses.get(eclass)
53
			replacement = self.deprecated_eclasses.get(eclass)
56
			if replacement is None:
54
			if replacement is None:
57
				pass
55
				pass
58
			elif replacement is False:
56
			elif replacement is False:
59
				self._errors.append(
57
				errors.append(
60
					"please migrate from "
58
					"please migrate from "
61
					"'%s' (no replacement) on line: %d" % (eclass, num + 1))
59
					"'%s' (no replacement)" % eclass)
62
			else:
60
			else:
63
				self._errors.append(
61
				errors.append(
64
					"please migrate from "
62
					"please migrate from "
65
					"'%s' to '%s' on line: %d" % (eclass, replacement, num + 1))
63
					"'%s' to '%s'" % (eclass, replacement))
66
64
		return errors
67
	def end(self):
68
		for error in self._errors:
69
			yield error
70
		del self._errors
(-)a/repoman/lib/repoman/modules/linechecks/do/dosym.py (-1 / +1 lines)
Lines 15-18 class EbuildNonRelativeDosym(LineCheck): Link Here
15
	def check(self, num, line):
15
	def check(self, num, line):
16
		match = self.regex.match(line)
16
		match = self.regex.match(line)
17
		if match:
17
		if match:
18
			return "dosym '%s'... could use relative path" % (match.group(1), ) + " on line: %d"
18
			return "dosym '%s'... could use relative path" % match.group(1)
(-)a/repoman/lib/repoman/modules/linechecks/eapi/checks.py (-5 / +5 lines)
Lines 19-25 class UndefinedSrcPrepareSrcConfigurePhases(LineCheck): Link Here
19
		m = self.src_configprepare_re.match(line)
19
		m = self.src_configprepare_re.match(line)
20
		if m is not None:
20
		if m is not None:
21
			return ("'%s'" % m.group(1)) + \
21
			return ("'%s'" % m.group(1)) + \
22
				" phase is not defined in EAPI < 2 on line: %d"
22
				" phase is not defined in EAPI < 2"
23
23
24
24
25
# EAPI-3 checks
25
# EAPI-3 checks
Lines 34-40 class Eapi3DeprecatedFuncs(LineCheck): Link Here
34
		m = self.deprecated_commands_re.match(line)
34
		m = self.deprecated_commands_re.match(line)
35
		if m is not None:
35
		if m is not None:
36
			return ("'%s'" % m.group(1)) + \
36
			return ("'%s'" % m.group(1)) + \
37
				" has been deprecated in EAPI=3 on line: %d"
37
				" has been deprecated in EAPI=3"
38
38
39
39
40
# EAPI <4 checks
40
# EAPI <4 checks
Lines 49-55 class UndefinedPkgPretendPhase(LineCheck): Link Here
49
		m = self.pkg_pretend_re.match(line)
49
		m = self.pkg_pretend_re.match(line)
50
		if m is not None:
50
		if m is not None:
51
			return ("'%s'" % m.group(1)) + \
51
			return ("'%s'" % m.group(1)) + \
52
				" phase is not defined in EAPI < 4 on line: %d"
52
				" phase is not defined in EAPI < 4"
53
53
54
54
55
# EAPI-4 checks
55
# EAPI-4 checks
Lines 64-70 class Eapi4IncompatibleFuncs(LineCheck): Link Here
64
		m = self.banned_commands_re.match(line)
64
		m = self.banned_commands_re.match(line)
65
		if m is not None:
65
		if m is not None:
66
			return ("'%s'" % m.group(1)) + \
66
			return ("'%s'" % m.group(1)) + \
67
				" has been banned in EAPI=4 on line: %d"
67
				" has been banned in EAPI=4"
68
68
69
69
70
class Eapi4GoneVars(LineCheck):
70
class Eapi4GoneVars(LineCheck):
Lines 80-83 class Eapi4GoneVars(LineCheck): Link Here
80
		m = self.undefined_vars_re.match(line)
80
		m = self.undefined_vars_re.match(line)
81
		if m is not None:
81
		if m is not None:
82
			return ("variable '$%s'" % m.group(1)) + \
82
			return ("variable '$%s'" % m.group(1)) + \
83
				" is gone in EAPI=4 on line: %d"
83
				" is gone in EAPI=4"
(-)a/repoman/lib/repoman/modules/linechecks/emake/emake.py (-1 / +1 lines)
Lines 20-23 class WantAutoDefaultValue(LineCheck): Link Here
20
		m = self._re.match(line)
20
		m = self._re.match(line)
21
		if m is not None:
21
		if m is not None:
22
			return 'WANT_AUTO' + m.group(1) + \
22
			return 'WANT_AUTO' + m.group(1) + \
23
				' redundantly set to default value "latest" on line: %d'
23
				' redundantly set to default value "latest"'
(-)a/repoman/lib/repoman/modules/linechecks/phases/phase.py (-2 / +2 lines)
Lines 53-59 class SrcCompileEconf(PhaseCheck): Link Here
53
			m = self.configure_re.match(line)
53
			m = self.configure_re.match(line)
54
			if m is not None:
54
			if m is not None:
55
				return ("'%s'" % m.group(1)) + \
55
				return ("'%s'" % m.group(1)) + \
56
					" call should be moved to src_configure from line: %d"
56
					" call should be moved to src_configure"
57
57
58
58
59
class SrcUnpackPatches(PhaseCheck):
59
class SrcUnpackPatches(PhaseCheck):
Lines 68-71 class SrcUnpackPatches(PhaseCheck): Link Here
68
			m = self.src_prepare_tools_re.search(line)
68
			m = self.src_prepare_tools_re.search(line)
69
			if m is not None:
69
			if m is not None:
70
				return ("'%s'" % m.group(1)) + \
70
				return ("'%s'" % m.group(1)) + \
71
					" call should be moved to src_prepare from line: %d"
71
					" call should be moved to src_prepare"
(-)a/repoman/lib/repoman/modules/linechecks/portage/internal.py (-5 / +2 lines)
Lines 20-26 class PortageInternal(LineCheck): Link Here
20
		"""Run the check on line and return error if there is one"""
20
		"""Run the check on line and return error if there is one"""
21
		m = self.re.match(line)
21
		m = self.re.match(line)
22
		if m is not None:
22
		if m is not None:
23
			return ("'%s'" % m.group(2)) + " called on line: %d"
23
			return "'%s' called" % m.group(2)
24
24
25
25
26
class PortageInternalVariableAssignment(LineCheck):
26
class PortageInternalVariableAssignment(LineCheck):
Lines 30-37 class PortageInternalVariableAssignment(LineCheck): Link Here
30
30
31
	def check(self, num, line):
31
	def check(self, num, line):
32
		match = self.internal_assignment.match(line)
32
		match = self.internal_assignment.match(line)
33
		e = None
34
		if match is not None:
33
		if match is not None:
35
			e = 'Assignment to variable %s' % match.group(2)
34
			return 'Assignment to variable %s' % match.group(2)
36
			e += ' on line: %d'
37
		return e
(-)a/repoman/lib/repoman/modules/linechecks/quotes/quoteda.py (-1 / +1 lines)
Lines 13-16 class EbuildQuotedA(LineCheck): Link Here
13
	def check(self, num, line):
13
	def check(self, num, line):
14
		match = self.a_quoted.match(line)
14
		match = self.a_quoted.match(line)
15
		if match:
15
		if match:
16
			return "Quoted \"${A}\" on line: %d"
16
			return "Quoted \"${A}\""
(-)a/repoman/lib/repoman/modules/linechecks/useless/dodoc.py (-1 / +1 lines)
Lines 13-16 class EbuildUselessDodoc(LineCheck): Link Here
13
	def check(self, num, line):
13
	def check(self, num, line):
14
		match = self.uselessdodoc_re.match(line)
14
		match = self.uselessdodoc_re.match(line)
15
		if match:
15
		if match:
16
			return "Useless dodoc '%s'" % (match.group(2), ) + " on line: %d"
16
			return "Useless dodoc '%s'" % match.group(2)
(-)a/repoman/lib/repoman/modules/linechecks/whitespace/blank.py (-2 / +1 lines)
Lines 14-20 class EbuildBlankLine(LineCheck): Link Here
14
14
15
	def check(self, num, line):
15
	def check(self, num, line):
16
		if self.line_is_blank and self.blank_line.match(line):
16
		if self.line_is_blank and self.blank_line.match(line):
17
			return 'Useless blank line on line: %d'
17
			return 'Useless blank line'
18
		if self.blank_line.match(line):
18
		if self.blank_line.match(line):
19
			self.line_is_blank = True
19
			self.line_is_blank = True
20
		else:
20
		else:
21
- 

Return to bug 699508