Comments (11)
@smfn3321 waiting for your opinion here
from coala.
@cw1 your's is valued too
from coala.
This would solve how the use finds out about what the bear is capable of so I'm in favor of it. I'm actually thinking about redesigning our bear architecture a bit. Imagine a bear developer could just write his object as:
class SpaceConsistencyBear(LocalBear):
def run_bear(self, filename, file, tab_width, allow_trailing_spaces=False):
pass # ok we'll want to do something here but thats irrelevant for this example
We then could analyze the signature of this function with inspect.getfullargspec(some_bear.run_bear)
, thus we could get the settings for the bear and he doesn't have to deal with the settings dict. Furthermore we can extrapolate the needed settings (which is the names of the parameters after, excluding, file) and the minimal_needed_settings. Maybe we could even get a help text from the documentation comment.
from coala.
Your last comment sounds good. Is this the way we can produce a help massage for the user for any giving bear? What kind of syntax would you like to prefer for the documentation comment?
from coala.
usual doc comment like we use all day long in coala.
from coala.
first draft of documentation parser is here: https://github.com/sils1297/coala/blob/wip/extract_needed_params/coalib/parsing/DocumentationCommentParser.py
I'm open to suggestions for simplifications.
from coala.
interesting:
>>> def test(var1, var2: test="t"):
... pass
...
>>> getfullargspec(test)
FullArgSpec(args=['var1', 'var2'], varargs=None, varkw=None, defaults=('t',), kwonlyargs=[], kwonlydefaults=None, annotations={'var2': <function test at 0x7f5c45a6fc80>})
from coala.
it works:
>>> from coalib.settings.FunctionMetadata import FunctionMetadata
>>> def test(p1, p2="test", p3=5):
... """
... tests something
...
... :param p2: its a test value
... :return nothing.
... """
... pass
...
>>> fm=FunctionMetadata.from_function(
... test)
>>> fm.name
'test'
>>> fm.desc
'tests something'
>>> fm.retval_desc
'nothing.'
>>> fm.non_optional_params
{'p1': 'No description given.'}
>>> fm.optional_params
{'p2': "its a test value (Optional, defaults to 'test'.)", 'p3': "No description given. (Optional, defaults to '5'.)"}
from coala.
began implementation on #150
from coala.
we now have this implemented in the SettingsCreatable, will migrate this to the bears soon. However we'll need code duplication avoidance strategies for this, I don't wanna copy it.
from coala.
lasse@lsmobfed21 ~/prog/gnome/srcn/gnome-boxes (git)-[master] % coala
Please enter a value for the setting "UseSpaces" (('True if spaces are to be used instead of tabs.', <class 'bool'>)) needed by SpaceConsistencyBear:
Works on #150. Outputter needs to be adjusted a bit though but Fabians creating the ConsoleOutputter from scratch anyway.
from coala.
Related Issues (20)
- test pipeline of travis.ci broken HOT 1
- Update URL of Travis CI in Adding_CI.rst HOT 3
- autopep8 section of .coafile fails
- Uniform string formatting HOT 18
- Required changes to sync moban HOT 1
- Throughput Graph in README needs to be updated HOT 2
- Link Does not exist HOT 3
- Add pytest to requirements.txt HOT 13
- Travis build failure due to setuptools-git HOT 2
- BuildManPage.py: Invalid syntax HOT 2
- Please invite me to the GitHub Community Organization
- Please invite me to the GitHub Community Organization
- I'm interested in joining coal and would love to contribute in your work.
- " An unknown error occurred. This is a bug. We are sorry for the inconvenience. Please contact the developers"
- Broken search
- cib not working, source code cannot be found
- Project dependencies have API risk issues
- ImportError: cannot import name 'Iterable' from 'collections' HOT 3
- Unable to use CheckstyleBear in .coafile
- Is this project still under maintaining? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coala.