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

feat - Add new file name guidelines #638

Conversation

bhaumikmistry
Copy link
Contributor

Description of Change

Added new file name guidelines, the new contribution needs to be in certain format to be used for the dynamic directory list generator. The file names will be validated using the actions in near future.

Checklist

  • Added description of change
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • Sort by alphabetical order
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
The old file names will be changes soon with one directory at a time.
The old PR might need some re-work.

@cclauss
Copy link
Member

cclauss commented Nov 27, 2019

Do we want uppercase directory names?
Do we want directory names that contain " " or "-"?
Do we need to test if a pull request creates a new directory? We don't want arbitrary directory names.

CONTRIBUTION.md Outdated
- Use lowercase words with ``"_"`` as separator
- For instance
```
MyNewCppClass.cpp is incorrect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this MyNewCppClass.CPP because we also care about the file extension (.cpp).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, agreed

CONTRIBUTION.md Outdated
```
- It will be used to dynamically create a directory of files and implementation.
- File name validation will run on docker to ensure the validity.

#### Commit Guidelines
- It is recommended to keep your changes grouped logically within individual commits. Contributors find it easier to review changes that are silt across multiple commits.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

silt --> split

@bhaumikmistry
Copy link
Contributor Author

bhaumikmistry commented Nov 27, 2019

Do we want uppercase directory names?
Do we want directory names that contain " " or "-"?
Do we need to test if a pull request creates a new directory? We don't want arbitrary directory names.
I have already worked on a cpp program which we can run in action which would validate the directory names for the rules that I have added in the new patch along with the file names guidelines. However for the new changes to be detected, we need to fix the current names of directory and files do you recommend anything for that? To make it easy and quick

@cclauss

you have already added an action to check the file name, lets have no space and - for the directory names to make it best practice and dynamically create a list as well

@cclauss
Copy link
Member

cclauss commented Nov 27, 2019

So we will need a mega-rename pull request that renames all directories and all filenames?

@bhaumikmistry
Copy link
Contributor Author

bhaumikmistry commented Nov 27, 2019

So we will need a mega-rename pull request that renames all directories and all filenames?

I guess so. Finally, any name(directory or file) cannot contain space and '-' , also only lower chars.
I think a pull request per directory would make more sense and would be stable and/or more structural.

@cclauss
Copy link
Member

cclauss commented Nov 28, 2019

All new or modified C++ files in a pull request will be tested by cpplint in https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/.github/workflows/cpplint_modified_files.yml and if they pass cpplint, they will also be tested for " ", "-", uppercase characters, and that they must be in directories.

@cclauss
Copy link
Member

cclauss commented Nov 28, 2019

One of the cpplint tests looks for a copyright comment in the file like
https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/Others/happy_number.cpp#L4

Do we want to encourage the addition of such comments or do we want to disable that test?

Other tests to consider: cpplint --filter=

  build/class
  build/c++11
  build/c++14
  build/c++tr1
  build/deprecated
  build/endif_comment
  build/explicit_make_pair
  build/forward_decl
  build/header_guard
  build/include
  build/include_subdir
  build/include_alpha
  build/include_order
  build/include_what_you_use
  build/namespaces_literals
  build/namespaces
  build/printf_format
  build/storage_class
  legal/copyright
  readability/alt_tokens
  readability/braces
  readability/casting
  readability/check
  readability/constructors
  readability/fn_size
  readability/inheritance
  readability/multiline_comment
  readability/multiline_string
  readability/namespace
  readability/nolint
  readability/nul
  readability/strings
  readability/todo
  readability/utf8
  runtime/arrays
  runtime/casting
  runtime/explicit
  runtime/int
  runtime/init
  runtime/invalid_increment
  runtime/member_string_references
  runtime/memset
  runtime/indentation_namespace
  runtime/operator
  runtime/printf
  runtime/printf_format
  runtime/references
  runtime/string
  runtime/threadsafe_fn
  runtime/vlog
  whitespace/blank_line
  whitespace/braces
  whitespace/comma
  whitespace/comments
  whitespace/empty_conditional_body
  whitespace/empty_if_body
  whitespace/empty_loop_body
  whitespace/end_of_line
  whitespace/ending_newline
  whitespace/forcolon
  whitespace/indent
  whitespace/line_length
  whitespace/newline
  whitespace/operators
  whitespace/parens
  whitespace/semicolon
  whitespace/tab
  whitespace/todo

@bhaumikmistry
Copy link
Contributor Author

One of the cpplint tests looks for a copyright comment in the file like
https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/Others/happy_number.cpp#L4

Do we want to encourage the addition of such comments or do we want to disable that test?

I think we are okay with not adding at this point. @cclauss

@cclauss
Copy link
Member

cclauss commented Dec 2, 2019

CONTRIBUTION.md Outdated
- File name validation will run on docker to ensure the validity.

#### New Directory guidelines
- Use lowercase words with ``"_"`` as separator ( no spaces or '-' allowed )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to say that it is best practice to try to use an existing directory rather than adding a new one?

Copy link
Contributor Author

@bhaumikmistry bhaumikmistry Dec 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added change

@@ -10,7 +10,8 @@ Contributors guide: https://github.com/TheAlgorithms/C-Plus-Plus/CONTRIBUTION.md
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] Added description of change
- [ ] Added tests and example, test passes
- [ ] Added file name matches [File name guidelines](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/CONTRIBUTION.md#New-File-Name-guidelines)
- [ ] Added tests and example, test must pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have some existing tests in this repo that we could site as examples?

Do we want to have a check box for:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpplint is run after the PR is created so the dev would have to edit the PR description after the checks have passed. Also working on a example test case and helper test cpp methods to be used for later and different pr.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cpplint can (and should) be run on their local machine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then need add guideline or script to do so?

add new directory updates.
CONTRIBUTION.md Outdated
@@ -38,7 +38,8 @@ my_new_cpp_class.cpp is correct format
- File name validation will run on docker to ensure the validity.

#### New Directory guidelines
- Use lowercase words with ``"_"`` as separator ( no spaces or '-' allowed )
- We recommend adding files to existing directories as mush as possible.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mush --> much

spell change for # new directory guidelines
@bhaumikmistry
Copy link
Contributor Author

@cclauss Approval?

@bhaumikmistry bhaumikmistry merged commit f2b8757 into TheAlgorithms:master Dec 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants