Commit Graph

48 Commits

Author SHA1 Message Date
Stephen Finucane 57d1e9afc9 Project Migration to PyCQA
This change rehomes the project to PyCQA [1] as reported to the
openstack-dev mailing list [2].

[1] https://mail.python.org/pipermail/code-quality/2019-July/001112.html
[2] http://lists.openstack.org/pipermail/openstack-discuss/2019-July/007878.html

Change-Id: I5472bea4994664495220ee4ab565f95666f21eee
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
Depends-On: I740c66cd959db1efa8ca8c9f29d4da4b66fbd993
2019-07-18 14:30:50 +01:00
Jenkins 88d50ec108 Merge "Remove os.path.abspath() in ignore paths" 2017-03-21 19:48:17 +00:00
Jenkins 711bac3c76 Merge "Fix ignore_path_errors call in main" 2017-03-21 19:48:12 +00:00
Julien Danjou 6868551b12 Remove os.path.abspath() in ignore paths
The filenames are actually relative in validate(), so nothing matches otherwise.

Change-Id: Ie9c3d2f0592817e893125f7725e9cd5e9037a942
2017-03-15 14:49:08 +01:00
Julien Danjou f612f0e508 Fix ignore_path_errors call in main
The `parse_ignore_path_errors' function expects a list of paths, not an
individual path.

Change-Id: Icc8a4721b38776d8268c731ea5b624a3e4a3b2a9
2017-03-15 14:07:12 +01:00
Ned Batchelder bcdaf5f788 Add a -q option to be silent on success
Change-Id: I5cd7f72694d525420a46e5ec2aca1b394bbf7b90
2017-01-14 20:01:59 -05:00
Joshua Harlow 062bf244b6 Lowercase the help messages
It seems to be common practice to lowercase these instead
of uppercasing the first word so let's just follow that
practice.

Change-Id: I2c8620257cd9f0566e1d7e1ec88461f18f0bcef4
2015-04-09 08:26:27 -07:00
Jenkins 24a3c9642a Merge "Allow ignore specific error codes in files" 2015-04-09 15:08:03 +00:00
Joshua Harlow b2adee882b Allow ignore specific error codes in files
Instead of only ignoring full files or ignoring full
codes for all files, allow for ignoring specific errors
for certain files.

Change-Id: I0ebfbe1d2dc68990c84bc0b47d872e44e19b5b2a
2015-03-09 15:57:04 -07:00
Joshua Harlow 7ad4aaec88 Handle the linter returning anonyomous line numbers
When sphinx (and by association restructuredtext-lint)
finds an error with say a anonymous backref it does not
include the line number (it defaults to none); so in this
case covert that line number to ? and output that as the
line number in the output shown to the user.

Change-Id: I013857cdb6a24cf11d94265358b8294dfed0236d
2015-03-05 22:56:51 +00:00
Jenkins 19cc3f5576 Merge "Fix the 'ignore-path' config option" 2014-10-25 00:28:30 +00:00
Jenkins 00a13a3239 Merge "Allow overriding file encoding" 2014-10-23 19:35:54 +00:00
Joshua Harlow 666805dd8e Fix the 'ignore-path' config option
The option shouldn't be named 'ignore_path' but should be
named 'ignore-path' to match the docs and to match the CLI
argument.

Change-Id: If5346910b259a0c092eea5c9adde281c2f2ff347
2014-10-23 12:35:17 -07:00
Joshua Harlow 04a710c687 Allow overriding file encoding
Chardet doesn't always seem to correctly detect files encoding
correctly in all circumstances, to make it so that a user can
specify the exact encoding of there files allow a new config
option and a new CLI option that allows for manually overriding
the encoding that chardet will try to determine.

If enabled chardet detection will no longer run.

Fixes bug 1384463

Change-Id: Ie8baf3f79083e1495c7420a9d0569390cad2115e
2014-10-22 17:30:58 -07:00
Christian Berendt 5a4341727e Add check D005 - no newline at end of file
Change-Id: I160bb7e9b3c904655567caee999ac91366668109
2014-09-30 21:44:59 +02:00
Joshua Harlow 3912dca016 Allow a default_extension to be provided
When a file is found without an extension allow a CLI
provided default_extension to be used in these cases
so that files without extensions can be classified as
known file extension types.

Change-Id: I115ccc92ccd51a7018672b98b639ade30869f939
2014-09-17 17:56:45 -07:00
Joshua Harlow 87bcf0bb32 Just use get() instead of pop()
Now that these are functions we don't need to
destroy the incoming configuration dictionary
by popping things from it.

Change-Id: I5d0ff032f0e7c9e79d39c3f5d533c43801502a8c
2014-09-08 11:47:28 -07:00
Joshua Harlow 355029419e Split the main function into pieces
Have there be a scanning function that contained the
previous file scanning logic, then a validating function
that did the checking logic and then have the main function
call into those functions instead of containing all the
same logic in its own function.

Change-Id: Ie35665a016164122be294fee41e7ce54605d832e
2014-09-08 11:42:38 -07:00
Andreas Jaeger 83de2e6912 Improve help options
Capitalize help strings and end with "." to follow best practice from
other tools. Also improve some strings.

Change-Id: I7005f4a187385096d6a9c1e5cb1322ba76048a1c
2014-09-07 17:53:45 +02:00
Christian Berendt 5ad3729895 Use list of FILE_PATTERNS as default for --extension
Change-Id: Ia74f04688c523555c57bc5b3ec3217e79d231e11
2014-09-06 11:37:17 +02:00
Joshua Harlow 4785188023 Document the exceptions are for RST format only
Change-Id: Ia0d17b89e0020fd32626cf6510d9862421a853c6
2014-09-05 17:18:25 -07:00
Joshua Harlow fdfeef577e Log that the check does not understand the extension when verbose
Instead of always printing that the check was skipped when in non
verbose mode, log/print it only when verbose mode is enabled and not
otherwise.

Change-Id: I0190b9d82568fb18871591d64ec6bd4695751367
2014-09-04 16:18:29 -07:00
Jenkins a90983acad Merge "Add version argument and output" 2014-09-04 19:00:47 +00:00
Jenkins 392d4c9eaf Merge "Allow checks to provide a extension matcher" 2014-09-04 19:00:12 +00:00
Joshua Harlow 9169ab6a7b Add version argument and output
Change-Id: I71c970c338297ada898fe5df887ecb975f7c3b29
2014-09-03 15:20:19 -07:00
Joshua Harlow 15ee57b572 Allow checks to provide a extension matcher
When a check is for a rst file vs a plaintext
file and is not interoperable this change allows
that check to declare that it only knows how to
scan certain files.

It also fixes the max line checker to use a similar
routine to differentiate between rst files and non
rst files and uses a different routine based on this
decision.

Change-Id: I1e3e5f9f1631ed5babe2df17c987e8e872938a38
2014-09-03 15:19:21 -07:00
Jenkins b0bae5f517 Merge "Add ignore_paths to ini file and document ini with example" 2014-09-01 16:43:00 +00:00
Jenkins 1e243fe333 Merge "Correctly ignore parent directories when requested" 2014-09-01 16:42:13 +00:00
Joshua Harlow 217eb5e7be Add ignore_paths to ini file and document ini with example
Change-Id: I23c08a5d2c7e85f0bd8cb8f2ad49ac91b46e91ca
2014-09-01 08:30:01 -07:00
Joshua Harlow 9b439777f4 Use print when in verbose mode
Instead of mixing print and logging usage in the main
program just instead use print directly, this still
configures logging incase we use a library which has
useful output that verbose mode should display.

Change-Id: I38e77ba53e72d68e612d77d4b2c9b6af465d385c
2014-08-30 18:05:36 -07:00
Joshua Harlow 73639a04db Correctly ignore parent directories when requested
Also does a ninja fix for undetectable decoding (by
assuming those files are utf-8 as a fallback, which
seems reasonable to do when chardet is unable to
figure out the encoding).

Fixes bug 1363191

Change-Id: I15c172f511a939b21c37f772eb17f78105acf648
2014-08-30 10:46:41 -07:00
Joshua Harlow 0372073a63 Fix partially ignored checks
When a check has only a subset of its
codes requested to be ignored we need
to make sure when we run that check that
we still skip the codes that were requested
to be ignored (and let the ones that were
not requested passthrough).

Change-Id: I05f419a8d99fa0cd9cea50e264e2a4c4a64376bd
2014-08-16 18:45:24 -07:00
Joshua Harlow 0499ba81bd Improve logging/printed output
Add in a verbose mode that uses logging to output more
information when available. Also adjusts the output to
show which checks had which errors (which is useful to
know and is useful in general) as well as show the total
number of errors accumulated (and the specific break
downs).

Change-Id: Ia965aa7c7c3576230668217aa09cf61dc4ecd303
2014-08-16 18:31:03 -07:00
Joshua Harlow 8ea62aff22 Fix destination
Change-Id: Idaaa34955d3133329e713961fd3dff28796f3812
2014-08-15 15:43:39 -07:00
Joshua Harlow 478b87b106 Add a sphinx specific mode
When doc8 scans rst files with sphinx specific roles
and references it is unable to determine what those roles
are and then complains that these false positives are
actual errors.

To avoid these types of false positives add a option that
can be provided when running on files that may contain these
types of errors to allow them to be skipped/ignored.

Change-Id: Ia6896617534f68e517d5996d53cf2de274507f56
2014-08-15 15:05:41 -07:00
Joshua Harlow 857f5feaff Update the README.rst with the ignore-path option
Also update the option parser to set the metavar
for the new ignore-path argument to 'path' (instead of
the default of 'IGNORE_PATH' which the option parser
generates automatically).

Change-Id: I13c845c13f4b80511dc4d5b179ba80030e8b9972
2014-08-13 07:49:02 -07:00
Christian Berendt 5fb44c1213 Add parameter --ignore-path to ignore files/directories
If the path is a file the file will not be checked for style
issues.

If the path is a directory all files inside this directory or
subdirectories will not be checked for style issues.

Change-Id: Ic40f798fb65804844e545de72263c44a8a603a40
2014-08-13 15:12:49 +02:00
Christian Berendt c8e8a72623 Remove unneeded definitions of Python Source Code Encoding
I think PEP 0263 (http://legacy.python.org/dev/peps/pep-0263/) is
not used anywhere else and so it should be removed when it's not
needed.

Change-Id: I013bf7f1df485d79b4cf17b874bfb22a0b920f2b
2014-08-01 14:18:54 +00:00
Joshua Harlow 83e9c42215 Add error linting to ensure that rst format is not invalid 2014-05-24 19:43:05 -07:00
Joshua Harlow c53e54c6fc Make running main.py directly work better 2014-05-24 19:13:47 -07:00
Joshua Harlow 85543ce0a1 Allow extensions to be provided
Allow the default set of extensions that are searched
for in the given directories to be overriden to be a smaller
or larger set than the defaults.
2014-05-23 19:07:16 -07:00
Joshua Harlow e050803234 Use a deque to avoid keeping all the scanned files alive
Avoid keeping all the files that have been read and scanned
in memory by use a deque and popping files off after they
have been read (this allows the gc to clean them up).
2014-05-18 20:34:24 -07:00
Joshua Harlow 1a6a4658b4 Use stevedore for dynamic check inclusion
Allow checks to be created outside of doc8
and use stevedore to load these check objects
and use them when checking.
2014-05-18 20:29:57 -07:00
Joshua Harlow d5693b2200 Add newline at end of main.py 2014-05-18 18:28:02 -07:00
Joshua Harlow 51cbe4f914 Move over the rest of the checks
Get the rest of the checks working (the
max line length check now works).

Remove the old script now that it is not
needed anymore.
2014-05-18 18:20:47 -07:00
Joshua Harlow f29204fefc Show the default max line length 2014-05-18 17:32:44 -07:00
Joshua Harlow f0316e8cc8 Gather files before running
Gather all the needed files before running so that
it's ensured that all files are ready to be used during
checking.
2014-05-18 17:31:05 -07:00
Joshua Harlow 2aa191e002 Add a main file and use it as a standard entrypoint
This moves away from having the script directory and
moves to the more standard console_scripts instead.
2014-05-18 16:38:59 -07:00