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

Add docs on writing aspect bear #4666

Merged
merged 1 commit into from Aug 29, 2017

Conversation

7 participants
@adhikasp
Member

adhikasp commented Aug 24, 2017

Relates to #4665
Contain commit from #4662

docs/Developers/Writing_Native_Bears.rst Outdated
https://github.com/coala/cEPs/blob/master/cEP-0005.md.
An aspect-compliant bear MUST:
1. Declare list of aspect it can fix and detected. Note that the aspect MUST be

This comment has been minimized.

@adhikasp

adhikasp Aug 24, 2017

Member

Blank line here

docs/Developers/Writing_Native_Bears.rst Outdated
3. Map setting to its equivalent aspect or taste using ``map_setting_to_aspect``
decorator.
4. Anotate yielded result with ``aspect``.

This comment has been minimized.

@hemangsk

hemangsk Aug 24, 2017

Member

Annotate*

coalib/bearlib/aspects/decorators.py Outdated
"""
Override function arguments value with coala's aspect and taste.
This decorators could be used by ``Bear.run()`` to automatically map and

This comment has been minimized.

@hemangsk

hemangsk Aug 24, 2017

Member

Suggestion: decorator can* might be better

@Nosferatul

This comment has been minimized.

Member

Nosferatul commented Aug 24, 2017

it looks good to me 👍

@jayvdb

This comment has been minimized.

Member

jayvdb commented Aug 26, 2017

This is waiting on #4662

docs/Developers/Writing_Native_Bears.rst Outdated
def run(self,
filename,
file,
use_standard_dictionary:bool=True,

This comment has been minimized.

@jayvdb

jayvdb Aug 27, 2017

Member

We typically have a space after :, which is the general style at https://www.python.org/dev/peps/pep-0484/

docs/Developers/Writing_Native_Bears.rst Outdated
languages=['Python']):
@map_setting_to_aspect(
use_standard_dictionary=DictionarySpelling

This comment has been minimized.

@jayvdb

jayvdb Aug 27, 2017

Member

comma not needed here??
please run your sample code through linters.

docs/Developers/Writing_Native_Bears.rst Outdated
class SpellingCheckBear(
LocalBear,
aspect={
'detect': [DictionarySpelling, OrgSpecificWordSpelling]

This comment has been minimized.

@jayvdb

jayvdb Aug 27, 2017

Member

trailing comma

docs/Developers/Writing_Native_Bears.rst Outdated
if word not in dictionary_words:
yield self.new_result(
message='Wrong spelling',
additional_info=(DictionarySpelling.docs

This comment has been minimized.

@jayvdb

jayvdb Aug 27, 2017

Member

shouldnt DictionarySpelling.docs.importance_reason be the default value for additional_info?

This comment has been minimized.

@adhikasp

adhikasp Aug 27, 2017

Member

Yes it should be. If you mean

If result have aspect arg, it should be defaulting to use aspect.docs.importance_reason

then, no, it is not implemented yet.

This comment has been minimized.

@jayvdb

jayvdb Aug 27, 2017

Member

Is there a bug about it?! If not, please create one!
This would fall in your main project scope, of making it easy to use aspects.

This comment has been minimized.

@adhikasp

This comment has been minimized.

@adhikasp

adhikasp Aug 27, 2017

Member

That issue is included in this PR too.

docs/Developers/Writing_Native_Bears.rst Outdated
for word in file.split():
if word not in dictionary_words:
yield self.new_result(
message='Wrong spelling',

This comment has been minimized.

@jayvdb

jayvdb Aug 27, 2017

Member

this message should include the value of word

docs/Developers/Writing_Native_Bears.rst Outdated
# Imagine this is where we save our standard dictionary.
dictionary_words = ['lorem', 'ipsum']
if not use_standard_dictionary:

This comment has been minimized.

@jayvdb

jayvdb Aug 27, 2017

Member

this logic is tortured.
use

if ...:
    dictionary_words = ['lorem', 'ipsum']
else:
    dictionary_words = []
@adhikasp

This comment has been minimized.

Member

adhikasp commented Aug 27, 2017

Contain additional commit to fix #4682

@jayvdb

not tested properly.

@jayvdb

jayvdb approved these changes Aug 28, 2017

@jayvdb

This comment has been minimized.

Member

jayvdb commented Aug 28, 2017

ack d41d691

@Nosferatul

This comment has been minimized.

Member

Nosferatul commented Aug 28, 2017

rebase and LGTM

@jayvdb

jayvdb approved these changes Aug 29, 2017

@jayvdb

This comment has been minimized.

Member

jayvdb commented Aug 29, 2017

reack 8c9141c

@jayvdb

This comment has been minimized.

Member

jayvdb commented Aug 29, 2017

@rultor merge

@rultor

This comment has been minimized.

Contributor

rultor commented Aug 29, 2017

@rultor merge

@jayvdb OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 8c9141c into coala:master Aug 29, 2017

6 of 9 checks passed

ci/circleci CircleCI is running your tests
Details
continuous-integration/appveyor/branch Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
codecov/project 100% (target 100%)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
review/gitmate/commit This commit has no issues. :)
Details
review/gitmate/manual This commit was acknowledged.
Details
review/gitmate/pr This PR has no issues. :)
Details
@rultor

This comment has been minimized.

Contributor

rultor commented Aug 29, 2017

@rultor merge

@jayvdb Done! FYI, the full log is here (took me 2min)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment