Skip to content
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

FilenameBear: default naming convention should be language specific in some cases #1083

Closed
jayvdb opened this issue Dec 3, 2016 · 13 comments · Fixed by #1530
Closed

FilenameBear: default naming convention should be language specific in some cases #1083

jayvdb opened this issue Dec 3, 2016 · 13 comments · Fixed by #1530
Assignees

Comments

@jayvdb
Copy link
Member

jayvdb commented Dec 3, 2016

Each language has different naming conventions that are very widely accepted.

  • python: snake
  • javascript: snake with hyphens
  • java: pascal

If it is too controversial to add this to the bear, setting the better default could be done in coala-quickstart, or quickstart could detect the predominate style. This problem came up regularly in the GCI linting tasks done by Besut Kode Universitas participants.

@jayvdb
Copy link
Member Author

jayvdb commented Dec 4, 2016

See https://github.com/bartvandebiezen/file-name-conventions for some collected notes on this topic.

@meetmangukiya
Copy link
Member

coala itself doesn't use snake case for filenaming 😟

@Makman2
Copy link
Member

Makman2 commented Dec 6, 2016

it's just about defaults, coala would obviously not stick to the python default :)

@yash-nisar
Copy link
Member

So should we ask the user to define the file naming convention instead ? @jayvdb @Makman2

@Makman2
Copy link
Member

Makman2 commented Mar 1, 2017

this is already possible, though sometimes you want to rely on the default settings for your language without specifying the naming-convention-setting.

yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 22, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python.

Closes coala#1083
@meetmangukiya
Copy link
Member

This can be better implemented and maintained this way IMO:

  • Create a dict that contains extensions as keys and lambdas that accept filename as argument and return the standard naming convention compliant name
  • Then try
try: 
  dict[extension](filename) 
except KeyError:
  # some nice message ?

This way there will be much less ifs if we want to add other language supports in future :)

@jayvdb
Copy link
Member Author

jayvdb commented Mar 22, 2017

The default is currently snake.

Ideally, we change the default file_naming_convention to None, but then we have two paths forward if the user doesnt set a value

  1. use snake, but warn the user that they should be explicit, and allow auto for the user to explicitly request that we guess the right convention
  2. guess the file_naming_convention, and fall back to snake if not known
  3. guess the file_naming_convention, and skip the file if not known

Only the first is backwards compatible. The other two are reasonable changes of behaviour.

Can we think of any other strategies?

@Makman2
Copy link
Member

Makman2 commented Mar 22, 2017

maybe make use of the language setting?

@yash-nisar
Copy link
Member

We have indirectly implemented 2 currently and the user can explicitly specify the file_naming_convention in the language setting of the .coafile. Now the main question is should we go with snake as the default one or set it to None ? CC @jayvdb @Makman2

@yash-nisar
Copy link
Member

Can be merged after #1533

@Makman2
Copy link
Member

Makman2 commented Mar 23, 2017

I'm for setting it to None, it's imo the better default behaviour.

@yash-nisar
Copy link
Member

Roger that @Makman2 :)

yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 24, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 24, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
@Makman2
Copy link
Member

Makman2 commented Mar 25, 2017

  1. use snake, but warn the user that they should be explicit, and allow auto for the user to explicitly request that we guess the right convention

I would use auto in that case, it confuses the user if we directly choose a non-fitting convention for the given language.

yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 25, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 26, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 26, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 26, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 26, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 26, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 26, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 29, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
yash-nisar added a commit to yash-nisar/coala-bears that referenced this issue Mar 31, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
gosom pushed a commit to gosom/coala-bears that referenced this issue Jul 15, 2017
Add default naming conventions that are widely accepted for
languages like java, javascript and python. Add 'auto' option
to predict the file naming convention.

Closes coala#1083
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants