Commit Graph

80 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
KATO Tomoyuki a96c31fb3e Skip long line check for rst definition list term
Change-Id: Ieb272e506034eac7129c24ee0e0fbc40b55d11b1
Closes-Bug: #1533238
2016-01-26 12:37:05 +09:00
Sam Stoelinga 64f22e443f Fix issue of checking max_len for directives
This patch changes the regex to also match directives
which start with whitespace.

Closes-Bug: #1487302

Change-Id: I4c3168228164d865cc31dfd24160c41267aeb016
2015-08-21 23:51:14 +08: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
Julien Danjou 4d82c269ab Fix Python 3 support
This fixes Python 3 support for doc8.

Change-Id: Id3f3a35f2d68c4cb6eefcf7a960d7991b8f4522f
2015-01-27 14:33:56 +01: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
Jenkins f2ec6f2550 Merge "Ignore long-lines with urls when in text searching mode" 2014-09-15 00:08:13 +00:00
Jenkins 3f7c58cf5a Merge "Ensure reading is done in one place only" 2014-09-15 00:07:37 +00:00
Joshua Harlow beed9aa8b8 Ensure reading is done in one place only
Instead of having reading being split across the lines_iter
method and the raw_content property just have it occur in
a common function so that it can be done once and only once.

Change-Id: I603bc4e85ad489d5397a78d6c987e15a0515f7ea
2014-09-11 13:12:53 -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
Joshua Harlow 06e610bde7 Ignore long-lines with urls when in text searching mode
Change-Id: I57b736d441b9650b0f7bc9efe9692b78b6cbf508
2014-09-08 11:38:32 -07:00
Jenkins 89779ed115 Merge "Cache the lines that are read instead of re-reading" 2014-09-08 17:30:04 +00: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
Joshua Harlow 674cbbcd59 Cache the lines that are read instead of re-reading
With-in the parsed file we cache the contents of the file
before it is converted to unicode and the contents of the
file after it is converted to unicode so it seems better to
follow this pattern and to also cache the raw lines (instead
of re-reading) as well.

Change-Id: Ic320a6c5517e513c88bdb4014d509a5791d85524
2014-09-07 00:23:15 +00:00
Jenkins 83c934fe34 Merge "Use list of FILE_PATTERNS as default for --extension" 2014-09-07 00:14:14 +00:00
Jenkins d95c74d421 Merge "Rewrite method contains_url in utils" 2014-09-07 00:12:01 +00:00
Christian Berendt 5ad3729895 Use list of FILE_PATTERNS as default for --extension
Change-Id: Ia74f04688c523555c57bc5b3ec3217e79d231e11
2014-09-06 11:37:17 +02:00
Jenkins 86712aba2c Merge "Use a documented constant for the docutils levels" 2014-09-06 09:34:54 +00:00
Christian Berendt c7c2a6c2f4 Rewrite method contains_url in utils
Change-Id: I05a0e6949f9411c52ef541f6061d965b607206ef
2014-09-06 11:27:56 +02:00
Joshua Harlow 9392f55fb7 Use a documented constant for the docutils levels
Instead of having a implicitly defined constant that doesn't
explain why the value was set use a documented frozenset that
has the valid docutils messaging levels with links/comments to
describe why they are being used.

Change-Id: I372c1babfb02c33b5881e2e6a12d464f75d944f7
2014-09-05 17:26:50 -07: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 5bbb86c198 Add basic check test cases
Change-Id: Icb4ef09b68618e562062d1d79b1b09b1cef72d79
2014-08-28 17:37:35 -07:00
Jenkins 74f4a31087 Merge "Use regex instead of prefix matches" 2014-08-28 07:42:29 +00:00
Jenkins 89f50215b4 Merge "Fix partially ignored checks" 2014-08-27 04:45:15 +00:00
Jenkins a0bab0082e Merge "Improve logging/printed output" 2014-08-27 04:43:54 +00:00
Joshua Harlow 687addf9b0 Detect the encoding using chardet
Instead of always assuming utf-8 (which is typically
ok) switch to using the chardet library and use it to
detect the incoming files encoding in a more accurate
manner.

Change-Id: I907c8f4e1a6682138b220b49fcfcff6eef85a0b3
2014-08-22 22:04:36 -07:00