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
bears/general: Add TextLintBear #1597
Conversation
bears/general/TextLintBear.py
Outdated
|
||
default_config = {'rules': rules, | ||
"plugins": [ | ||
"rst", "html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not use the preferred quotation marks.
QuotesBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/TextLintBear.py
+++ b/bears/general/TextLintBear.py
@@ -88,7 +88,7 @@
default_config = {'rules': rules,
"plugins": [
- "rst", "html"
+ "rst", 'html'
]
}
return json.dumps(default_config)
bears/general/TextLintBear.py
Outdated
|
||
default_config = {'rules': rules, | ||
"plugins": [ | ||
"rst", "html" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not use the preferred quotation marks.
QuotesBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/TextLintBear.py
+++ b/bears/general/TextLintBear.py
@@ -88,7 +88,7 @@
default_config = {'rules': rules,
"plugins": [
- "rst", "html"
+ 'rst', "html"
]
}
return json.dumps(default_config)
bears/general/TextLintBear.py
Outdated
} | ||
|
||
default_config = {'rules': rules, | ||
"plugins": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not use the preferred quotation marks.
QuotesBear, severity NORMAL, section python
.
The issue can be fixed by applying the following patch:
--- a/bears/general/TextLintBear.py
+++ b/bears/general/TextLintBear.py
@@ -87,7 +87,7 @@
}
default_config = {'rules': rules,
- "plugins": [
+ 'plugins': [
"rst", "html"
]
}
dc60d9d
to
5a737c1
Compare
Abreviate is a commonly misspelled word. | ||
So should be avoided at the beginning of a sentence. | ||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noeol@eof
bears/general/TextLintBear.py
Outdated
} | ||
|
||
rules['max-number-of-lines'] = { | ||
'max': 300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a bear which does this; this bear should accept the same configuration setting name.
trailing comma so future additions dont need to modify this line.
bears/general/TextLintBear.py
Outdated
@staticmethod | ||
def generate_config(filename, file): | ||
rules = { | ||
'no-todo': True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a bear which does this? If so, this bear should accept the same configuration setting name.
bears/general/TextLintBear.py
Outdated
'date-weekday-mismatch': True, | ||
'no-nfd': True, | ||
'no-surrogate-pair': True, | ||
'ginger': True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing comma so future additions dont need to modify this line. (and everywhere else)
bears/general/TextLintBear.py
Outdated
rules['unexpanded-acronym'] = { | ||
'min_acronym_len': 3, | ||
'max_acronym_len': 5, | ||
'ignore_acronyms': ['OSS'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a bear which does this? If so, this bear should accept the same configuration setting name.
bears/general/TextLintBear.py
Outdated
'ignore': [] | ||
} | ||
|
||
rules['write-good'] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isnt this a separate bear? again, this bear would need to match that bear settings.
bears/general/TextLintBear.py
Outdated
rules['no-dead-link'] = { | ||
'checkRelative': False, | ||
'baseURI': None, | ||
'ignore': [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a bear which does this? If so, this bear should accept the same configuration setting name.
5a737c1
to
83ad753
Compare
8e35a77
to
b9842f1
Compare
b9842f1
to
fe1b0c5
Compare
Aaaaannnddd the testsss passsss |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
1 similar comment
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
.travis.yml
Outdated
@@ -77,6 +77,7 @@ env: | |||
|
|||
before_install: | |||
# Remove Ruby directive from Gemfile as this image has 2.2.5 | |||
- nvm install 6.10.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the comment above about Ruby, relates to the line below about Ruby. And in the middle you've added Node ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very irresponsible act by me.
bears/general/TextLintBear.py
Outdated
NpmRequirement('textlint-rule-unexpanded-acronym', | ||
'1.2.1'), | ||
NpmRequirement('textlint-rule-write-good', '1.6.0'), | ||
PipRequirement('docutils-ast-writer', '0.1.2')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need docutils-ast-writer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dependency for the rst plugin, https://github.com/jimo1001/textlint-plugin-rst#installation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should comment on that above the PipRequirement
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
7 similar comments
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
Hey! This pull request hasn't been updated for a while :/ It would be nice if we could get this going again! |
bears/general/TextLintBear.py
Outdated
# Header B | ||
|
||
Text. | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah RST syntax please :3 (already forgotten that this is not Markdown :P)
... there is an empty section ``#Header A`` below:: <-- double colons
# Header A
# Header B
Text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe you want to shorten the example by one line too:
# Header A
# Header B
Text.
up to you :)
bears/general/TextLintBear.py
Outdated
check_common_misspellings: bool=True, | ||
write_good: bool=True, | ||
check_relative_links: bool=False, | ||
base_uri: str='null', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about leaving the default empty? Though it seems that textlint doesn't like this :3
bears/general/TextLintBear.py
Outdated
|
||
@linter(executable='textlint', | ||
output_format='regex', | ||
output_regex=r'(?P<line>\d+):(?P<column>\d+)[\s*|✓]*(?P<severity>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[\s*|checkmark-character]
--> (?:\s|checkmark-character)*
[]
denotes a character class and is not the same as a group ()
. Also you don't need the quantifier behind \s
if you define it for the group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bears/general/TextLintBear.py
Outdated
|
||
@linter(executable='textlint', | ||
output_format='regex', | ||
output_regex=r'(?P<line>\d+):(?P<column>\d+)[\s*|✓]*(?P<severity>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know python supports unicode, though I wouldn't stress that support on different platforms. Is it possible to write the checkmark character as some kind of unicode-code? Like \x0030
or so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pasted this in the wrong comment box, should be pasted here.
8270a9d
to
651a2ec
Compare
Some changes that I think will be helpful :
|
Some minor improvements done, @Makman2 your turn to review. |
Alright, though the name |
bears/general/TextLintBear.py
Outdated
r'(?: .*|\n|$)') | ||
class TextLintBear: | ||
""" | ||
The pluggable linting tool for text and markdown. It is similar to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm Wikipedia writes markdown
uppercase. Let's follow that convention :)
bears/general/TextLintBear.py
Outdated
class TextLintBear: | ||
""" | ||
The pluggable linting tool for text and markdown. It is similar to | ||
ESLint, but textlint for natural language. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"but textlint for natural language"? I mean you are just describing TextLint
and referring to itself again? :)
Maybe just: It is similar to ESLint, but covers natural language (instead).
(The "instead" is optional)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe, didn't notice that. Sorry
list of common misspellings. | ||
:param allow_passive_voice: | ||
Allows passive voice. | ||
:param allow_so_beginning: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting rename:
allow_sentence_beginning_with_so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've followed the standard used in https://github.com/coala/coala-bears/blob/master/bears/natural_language/WriteGoodLintBear.py#L37.
Maybe we should rename both the instances or keep this as it is ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah then keep it :)
Allows passive voice. | ||
:param allow_so_beginning: | ||
Allows ``So`` at the beginning of a sentence. | ||
:param allow_adverbs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should be more precise with that setting name, as completely removing adverbs in a text is going to make things hard :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've followed the standard used in https://github.com/coala/coala-bears/blob/master/bears/natural_language/WriteGoodLintBear.py#L38
Maybe we should rename both the instances or keep this as it is ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep it then :)
``very``, ``extremely``, etc. | ||
:param allow_repeated_words: | ||
Allows lexical illusions, i.e. cases where a word is repeated. | ||
:param allow_there_is: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe also call it allow_sentence_beginning_with_there_is
? Not sure, as it's quite clear what's meant^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've followed the standard used in https://github.com/coala/coala-bears/blob/master/bears/natural_language/WriteGoodLintBear.py#L40
Maybe we should rename both the instances or keep this as it is ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same, let's keep :)
bears/general/TextLintBear.py
Outdated
Allows ``There is`` or ``There are`` at the beginning of a | ||
sentence. | ||
:param allow_ambiguous_words: | ||
Allows ``weasel words`` for example ``often``, ``probably``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-->
Allows "weasel words" like "often" or "probably".
I think we should use regular double quotes as those are words referring to standard prose. For me code-highlighting means it's referring to some kind of specific technical/informatics term^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or
Allows "weasel words", for example "often" or "probably".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used the same documentation as here. So, is it okay or do we need to change it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change, I think we should also change it for WriteGoodLintBear
(there's also missing a period actually^^)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opening an issue in a while ;)
651a2ec
to
3556ed3
Compare
Updated @Makman2 |
|
||
@linter(executable='textlint', | ||
output_format='regex', | ||
output_regex=r'(?P<line>\d+):(?P<column>\d+)(?:\s|\u2713)*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't forget that we use raw-strings :D \u2713
will be rendered here as \u2713
actually and not ✓
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah nvm, regex parses those \u
escapes itself :D
bears/general/TextLintBear.py
Outdated
class TextLintBear: | ||
""" | ||
The pluggable linting tool for text and Markdown. It is similar to ESLint, | ||
but covers natural language (instead). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either
but covers natural language.
or
but covers natural language instead.
Sorry I think I should have been more clear with that :P
"textlint-rule-period-in-list-item": "~0.2.0", | ||
"textlint-rule-rousseau": "~1.4.5", | ||
"textlint-rule-unexpanded-acronym": "~1.2.1", | ||
"textlint-rule-write-good": "~1.6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious: Our package requirements don't support the ~
operator, right? (yet)
to indicate a rough version specification^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC, nope. Maybe that is why we specify the exact version like NpmRequirement('textlint', '7.3.0')
3556ed3
to
d09c8f9
Compare
ack d09c8f9 |
@rultor merge |
Closes #1576
For short term contributors: we understand that getting your commits well
defined like we require is a hard task and takes some learning. If you
look to help without wanting to contribute long term there's no need
for you to learn this. Just drop us a message and we'll take care of brushing
up your stuff for merge!
Checklist
them.
individually. It is not sufficient to have "fixup commits" on your PR,
our bot will still report the issues for the previous commit.) You will
likely receive a lot of bot comments and build failures if coala does not
pass on every single commit!
After you submit your pull request, DO NOT click the 'Update Branch' button.
When asked for a rebase, consult coala.io/rebase
instead.
Please consider helping us by reviewing other peoples pull requests as well:
cobot mark wip <URL>
to get it outof the review queue.
The more you review, the more your score will grow at coala.io and we will
review your PRs faster!