Merge lp://staging/~adiroiban/pocket-lint/plugin-system into lp://staging/pocket-lint

Proposed by Adi Roiban
Status: Needs review
Proposed branch: lp://staging/~adiroiban/pocket-lint/plugin-system
Merge into: lp://staging/pocket-lint
Diff against target: 308 lines (+155/-58)
2 files modified
pocketlint/contrib/pep257_plugin.py (+97/-0)
pocketlint/formatcheck.py (+58/-58)
To merge this branch: bzr merge lp://staging/~adiroiban/pocket-lint/plugin-system
Reviewer Review Type Date Requested Status
Curtis Hovey Pending
Review via email: mp+215554@code.staging.launchpad.net

Description of the change

Description
-----------

I want to have google-js-linter, pep257 , some custom regex checkers, css/LESS/SASS checker, HTML5 etc... then there is jshint/jslint ... maybe someone want pylint :)

I think that is hard to ship all this checkers with pocket lint.

One option is to let pocket-link define a framework for checkers and then users can add custom checkers as plugins.

Each plugin has its own configuration and can also use global configuration (once we have a well defined configuration object)

Changes
-------

As a drive-by fix I have updated PocektLintOption to not have the dirty hack for filling values from command line options.

PocketLintOption now have the addPlugin method... there is no method to remove plugins :)

I have defined a base Pluging which can register itself for a list of languages. We might want a checker for all files... ex line lenght like checker or tab checker or traling spaces checker

check is the entry paint and a helper for calling the plugin for multiple files.

check_all is the main method which should be defined by plugins.

I am also thinking at check_line to remove the need for plugins to split the file if they only want to do line checks.

I added `enabled` attribute, but I am not sure if it make sense... From an 3rd party user, if plugin is not enable, just don't add it. I am thinking that maybe we want to use the plugin system for own checker... like jshint.

Please let me know what do you think.\

Does it make sense? Do you find it useful? Is the API ok?

Thanks!

To post a comment you must log in.

Unmerged revisions

453. By Adi Roiban <email address hidden>

Initial code for plugin system.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to all changes: