Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permit the user to specify module's name together with the file path #881

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 9 additions & 11 deletions pylint/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,9 @@
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
""" %prog [options] module_or_package
"""%prog [options] path

Check that a module satisfies a coding standard (and more !).

%prog --help

Display this help message and exit.

%prog --help-msg <msg-id>[,<msg-id>]

Display help messages about given message identifiers and exit.
Check python code for coding standard, static error, and coding style.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change this, see my comment below.

"""
from __future__ import print_function

Expand Down Expand Up @@ -54,6 +46,12 @@


MANAGER = astroid.MANAGER
USAGE = __doc__ + """
Argument:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be documented. From my point of view, this is the hack we're supporting for linter-atom's sake.

path Package name, full module name, file path, or full
module name alongside with the file path separated
by the system-specific search path delimiter (e.g.
module.name{0}/path/to/file.py.)""".format(os.pathsep)


def _get_new_args(message):
Expand Down Expand Up @@ -452,7 +450,7 @@ def __init__(self, options=(), reporter=None, option_groups=(),
utils.MessagesHandlerMixIn.__init__(self)
utils.ReportsHandlerMixIn.__init__(self)
super(PyLinter, self).__init__(
usage=__doc__,
usage=USAGE,
version=full_version,
config_file=pylintrc or config.PYLINTRC)
checkers.BaseTokenChecker.__init__(self)
Expand Down
9 changes: 7 additions & 2 deletions pylint/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,6 @@ def list_messages(self):
print(msg.format_help(checkerref=False))
print("")


class ReportsHandlerMixIn(object):
"""a mix-in class containing all the reports and stats manipulation
related methods for the main lint class
Expand Down Expand Up @@ -805,7 +804,11 @@ def _basename_in_blacklist_re(base_name, black_list_re):

def expand_modules(files_or_modules, black_list, black_list_re):
"""take a list of files/modules/packages and return the list of tuple
(file, module name) which have to be actually checked
(file, module name) which have to be actually checked.

You might also provide the full module name alongside with the
file to be checked. Ex.: package.module.name:/path/to/file.py.
This prevent us from guessing the module name from the file path.
"""
result = []
errors = []
Expand All @@ -820,6 +823,8 @@ def expand_modules(files_or_modules, black_list, black_list_re):
filepath = join(something, '__init__.py')
else:
filepath = something
elif os.pathsep in something:
modname, filepath = something.split(os.pathsep)
else:
# suppose it's a module or package
modname = something
Expand Down