Git Product home page Git Product logo

coala-quickstart's Introduction

image

coala-quickstart: personalized coala setup for your project

coala-quickstart is a tool that helps users to quickly get started with coala. It can generate a .coafile ( coala's configuration file) that is tailored to your project. This supports projects in several languages, including popular languages such as C/C++, Python, JavaScript, CSS, Java.

Please note that you will want to manually adapt the configuration to your needs!



Features

  • Out-of-the-box support for projects using various popular languages, such as C/C++, Python, Javascript, CSS, Java and many others with built-in check routines.
  • Automatic identification of relevant bears for your project based on the languages used.
  • A clean and simple interface with a well defined flow.

Installation

To install the latest stable version run:

$ pip3 install coala-quickstart

Stable

To install the latest development version run:

$ git clone https://github.com/coala/coala-quickstart
$ cd coala-quickstart
$ pip3 install . 

Use the -e tag to install coala-quickstart in the editable mode which will allow you to make changes to the local repository and have them take effect in coala-quickstart immediately. For that, use the last commmand as:

$ pip3 install -e .

PyPI Windows Linux


Usage

coala-quickstart is designed with ease of use and simplicity in mind. To get started, simply run:

$ coala-quickstart

This should prompt you for the project directory. If you want to use the current directory, just press the return key and we'll be on our way!

At the end, you should have a file named .coafile generated at the root of your project directory. This contains all the settings needed by coala to lint and fix your code.

When this is done, simply fire up coala from your project's root directory:

$ coala

You can also open the .coafile in your favorite editor and edit the settings to suit your needs. Check out our coafile specification to learn more.


Support

Feel free to contact us at our Gitter channel, we'd be happy to help!

You can also drop an email at our mailing list.


Authors

coala-quickstart is maintained by a growing community. Please take a look at the meta information in setup.py for the current maintainers.


License

AGPL

coala-quickstart's People

Contributors

adrianzatreanu avatar adtac avatar andreidinu avatar andrewda avatar cliu13 avatar divya063 avatar djmgit avatar guesswhosamfoo avatar hemangsk avatar illdepence avatar ishansrt avatar jackthepirate6 avatar jayvdb avatar kiy4h avatar laxmena avatar manankalra avatar mohitkyadav avatar namanyadav12 avatar naveenaidu avatar paniabhisek avatar plentymore avatar redridge avatar rishabhgarg25699 avatar saksham189 avatar satwikkansal avatar sils avatar utkarsh2102 avatar vamshi99 avatar virresh avatar wert1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coala-quickstart's Issues

README improvements

Cmon, im sure it can be better than this. Some usage sections, installation, better than this logo?
a brief explanation of what it is :D ?

Don't ask user about bears

It'd be better to ask user to confirm detected languages, then generate the config completely with comments.

That's way easier for him to follow.

Adding a --allow-incomplete-sections option

An --allow-partials-section option to generate a coafile with useable as well as unusable bears in CI mode. Presently it only generates one with useable bears in --ci mode, ie, bears not having non optional settings)

Reference:-
#90 (comment)

Validate user's input

Currently, the user inputs for the values of the settings are not validated and directly are directly written in the generated ".coafile". We need a way to validate those inputs first.

status/needs design

Use existing paths in Gruntfile.js

Gruntfile.js contains pre-existing configuration which will exist in mature projects, which can be used to create the correct .coafile configuration. e.g. https://github.com/wikimedia/jquery.ime

		jshint: {
			options: {
				jshintrc: true
			},
			all: [
				'*.js',
				'src/*.js',
				'rules/**/*.js',
				'test/**/*.js'
			]
		},
		jscs: {
			fix: {
				options: {
					fix: true
				},
				src: '<%= jshint.all %>'
			},
			main: {
				src: '<%= jshint.all %>'
			}
		},
		csslint: {
			all: [
				'css/**/*.css'
			]
		},

Those top level keys (csslint, jscs, jshint) are constant, and directly map to names of linters; but the sub-keys change per grunt plugin, but all and main are quite common. IMO quickstart should still find all relevant files, and then emit a message to say which relevant files have been excluded due to Gruntfile.js.

There is also a common, but not standard, excerpt to correctly choose necessary linters:

	grunt.registerTask( 'lint', [ 'jshint', 'jscs:main', 'csslint' ] );

It would be very nice to warn if any of the lint sub-tasks can not be mapped to a bear in coala.

CLI argument parsing problems

quickstart uses coalib, which relies heavily on the CLI and config loading routines.

get_filtered_bears is called, and it uses load_configuration , which calls coalib.parsing.DefaultArgParser.default_arg_parser, which is in fact the only arg parser and all coala apps are implicitly using.

The CLI arg parsing occurs after a bit of initial interaction with the user. e.g. if we use --foo, the error message uses the wrong program name, and shows all generic coala args as being valid.

$ coala-quickstart  --foo
                                         
  .o88Oo._                               
 d8P         .ooOO8bo._                  Hi there! Awesome you decided to do some
 88                  '*Y8bo.             high quality coding. coala is just the
 YA                      '*Y8b   __      tool you need!
  YA                        68o68**8Oo.  
   "8D                       *"'    "Y8o You can configure coala to suit your
    Y8     'YB                       .8D needs. This is done with a settings file
    '8               d8'             8D  called a `.coafile` in the project
     8       d8888b          d      AY   directory.
     Y,     d888888         d'  _.oP"    
      q.    Y8888P'        d8            We can help you with that. Let's get
       "q.  `Y88P'       d8"             started with some basic questions.
          Y           ,o8P               
               oooo888P"                 
                                         
What is your project directory? [/tmp] 

The contents of your .gitignore file for the project will be automatically loaded as the files to ignore.

The following languages have been automatically detected:
                       Go: 42%
                      C++:  8%
                   Python:  7%
                     HTML:  2%
               JavaScript:  2%
                       C#:  1%
                     Java:  1%
                 Markdown:  1%
                     YAML:  0%
                      CSS:  0%
                     Ruby:  0%
                      PHP:  0%
                      XML:  0%
                        C:  0%

usage: coala [-h] [-v] [-c FILE] [-F] [-I] [-s [FILE]] [--disable-caching]
             [--flush-cache] [-b NAME [NAME ...]] [-f FILE [FILE ...]]
             [-i FILE [FILE ...]] [--limit-files FILE [FILE ...]]
             [-d DIR [DIR ...]] [-V] [-L ENUM] [-m ENUM] [-B]
             [-l LANG [LANG ...]] [-p LANG [LANG ...]] [-D] [--show-details]
             [-S SETTING [SETTING ...]] [-a] [-j JOBS] [-n]
             [TARGETS [TARGETS ...]]
coala: error: unrecognized arguments: --foo

As best I can tell, all of these options are discarded, but I am still investigating that

"The default coafile '.coafile' was not found." warnings

coala-quickstart --ci is emitting lots of "The default coafile '.coafile' was not found." warnings
see https://travis-ci.org/jayvdb/Aurora/builds/185683597

WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.
WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.
WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.
WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.
WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.
WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.
WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.
WARNING:root:The default coafile '.coafile' was not found. You can generate a configuration file with your current options by adding the `--save` flag or suppress any use of config files with `-I`.

manifest

since our setuptools is running problems, do we need a MANIFEST.in that would include requirements.txt and probably README & License?

Language statistics do not add up to 100%

I ran coala-quickstart --ci on a project and the language statistics generated were as follows :

The following languages have been automatically detected:
                    C: 37%
               Python:  1%
             Markdown:  1%
                  C++:  0%`

This does not total to 100%. The language statistics for the same project on github were

 C: 97.5%
 Python: 2.3%
 Other: 0.2%

Running linguist locally fetches the following stats :

97.47%  C
2.30%   Python
0.14%   C++
0.09%   Makefile

Detect language of file based on shebang

In some project (mainly that specifically target linux platform) a file without extension is commonly found. Mainly they use shebang (!#/bin/sh or similiar) to specify language/intrepeter used.

AFAIK, coala-quickstart just detect used language based on their extension, so they fail to detect extensionless file. Also, in .coafile the file path need to be explicitly stated, because (ex. files = **.sh, image/base/*).

Project example
https://github.com/discourse/discourse_docker, see this folder

failed run coala-quickstart --ci

failed to run coala-quickstart --ci and got this error :

Traceback (most recent call last):

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 659, in _build_master

    ws.require(__requires__)

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 967, in require

    needed = self.resolve(parse_requirements(requirements))

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 858, in resolve

    raise VersionConflict(dist, req).with_context(dependent_req)

pkg_resources.ContextualVersionConflict: (six 1.8.0 (/usr/lib/python3.4/site-packages), Requirement.parse('six>=1.9.0'), {'bandit', 'stevedore'})



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "/usr/bin/coala-quickstart", line 6, in <module>

    from pkg_resources import load_entry_point

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3017, in <module>

    @_call_aside

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3003, in _call_aside

    f(*args, **kwargs)

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 3030, in _initialize_master_working_set

    working_set = WorkingSet._build_master()

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 661, in _build_master

    return cls._build_from_requirements(__requires__)

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 674, in _build_from_requirements

    dists = ws.resolve(reqs, Environment())

  File "/usr/lib/python3.4/site-packages/pkg_resources/__init__.py", line 858, in resolve

    raise VersionConflict(dist, req).with_context(dependent_req)

pkg_resources.ContextualVersionConflict: (six 1.8.0 (/usr/lib/python3.4/site-packages), Requirement.parse('six>=1.9.0'), {'bandit', 'stevedore'})

test

this is a duplicate and an enhancement

ci mode needs to bypass the "files to ignore" question

After the CI mode has been added, there is one remaining question by quickstart: which files to ignore.

This question only appears if there is not a .gitignore. That is git specific, which should be fixed. As a result, a workaround is to touch .gitignore, which will create this file if it exists, and the empty file is enough. A better workaround is to use a tool to generate a better .gitignore.

Also, the generic coala parameter --ignore doesnt work, even if the default arg parser is used. Fixing this is probably the best way to resolve this bug.

Add codecov

Coverage is only 61% . See coala/meta#86

We need to ensure it is going up over GSoC, not down.

Codecov to the rescue.

Running modes in coala-quickstart

webServices Status

webServices doesn't support all the bears presently. It doesn't support the bears which have nonoptional settings. As a solution, what we can do is run coala-quickstart on the project and get relevant bears, by running quickstart in a --relevant-bears mode

relevant_bears = ["PEP8Bear", "PyLintBear", "SpaceConsistencyBear"]

Then ask users for the optional/non-optional settings of those bears, and send this to the backend saving it in a settings.json file.

bears_settings = {
"PEP8Bear" : {},
"PyLintBear" : {}.
"SpaceConsistencyBear" : { "use_spaces" : true }
}

Then coala-quickstart would run in --get-bears-settings = settings.json mode, and return the frontend a coafile, with bear settings.

Users will now click a "Run coala" button (or we can do that without asking user ?) and then we run coala on the project with the generated coafile, which has optional/non optional settings for bears and thus doesn't break the module.

screen shot 2017-05-08 at 11 31 27 am

Essentialy, frontend will send flags to the backend which will then decide the running mode of coala-quickstart.

cc @adtac @satwikkansal Thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.