Date: Sun, 28 Oct 2012 10:33:19 +0000 (UTC) From: Chris Rees <crees@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r242215 - user/crees/rclint Message-ID: <201210281033.q9SAXJIf085501@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: crees (ports committer) Date: Sun Oct 28 10:33:19 2012 New Revision: 242215 URL: http://svn.freebsd.org/changeset/base/242215 Log: Unbreak function detection logic, and check that it is indented Modified: user/crees/rclint/errors.en user/crees/rclint/rclint.py Modified: user/crees/rclint/errors.en ============================================================================== --- user/crees/rclint/errors.en Sun Oct 28 10:18:46 2012 (r242214) +++ user/crees/rclint/errors.en Sun Oct 28 10:33:19 2012 (r242215) @@ -9,6 +9,7 @@ error_id message explanation file_order Order of rc file incorrect Order of the rc file should be shebang/header/$FreeBSD$/sourcing rc_subr/name/rcvar/load_rc_config/setting defaults/setting other definitions/defining functions. Do not include unassociated shell commands, and blocks must be separated by single blank lines. Single blank lines may appear inside the defaults, definitions and functions blocks functions_chown Useless use of chown? Using chown in functions can nearly always be replaced with appropriate use of install(1) +functions_indent Unindented function contents Style dictates that indentation of rc scripts should be tabs. Ensure that function contents are indented functions_inline_brace Inline brace in function Put the opening brace for a function ({) on its own line functions_neverending Unclosed function block Functions must end with a closing brace on its own line functions_problem Function incorrectly defined Functions should not have spaces in the definition @@ -31,7 +32,7 @@ run_rc_argument Incorrect argument to ru shebang Incorrect shebang used All rc scripts must start with the correct shebang; #!/bin/sh variables_defaults_mandatory_colon Override blanks in mandatory values (:=/:- vs =/-) Values that must not be blank (such as _enable) should be set by default as ${var:=value}; thus disallowing blank values (man sh) -variables_defaults_non_mandatory_colon Do not clobber blank values for non-mandatory variables Syntax for variables that are not mandatory is ${var=value}; including := will override var="" set in rc.conf (man sh) +variables_defaults_non_mandatory_colon Do not clobber blank values for non-mandatory variables Syntax for variables that are not mandatory is ${var=value}; including := will override var="" set in rc.conf (man sh). If this variable is mandatory just for this script, then ignore this error variables_defaults_old_style Prefer condensed version for setting default values of variables When setting the default value for a variable, it is much less verbose and clearer to use the : ${variable=var} notation, as well as it being obvious that the source and destination variable are the same variables_order Order of variables incorrect Order of the variables should be setting defaults then setting other variables Modified: user/crees/rclint/rclint.py ============================================================================== --- user/crees/rclint/rclint.py Sun Oct 28 10:18:46 2012 (r242214) +++ user/crees/rclint/rclint.py Sun Oct 28 10:33:19 2012 (r242215) @@ -194,7 +194,7 @@ class RcsId: class Function: def __init__(self, lines, num): - if lines[0] and lines[0][-1] == '{': + if len(lines[0]) > 1 and lines[0][-1] == '{': error.give('functions_inline_brace', num) elif lines[1] and lines[1][0] == '{': try: @@ -210,6 +210,8 @@ class Function: error.give('functions_neverending', num) break self.value.append(lines[self.length]) + if self.value[-1] and self.value[-1][0] not in '\t {}': + error.give('functions_indent', num + self.length) # Remove { and } lines from length self.length -= 2 logging.debug('Found function %s' % self.name)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210281033.q9SAXJIf085501>