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

Make sure that file name and defined class on the file matches. #3154

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

GustavoCaso
Copy link
Member

By following the Ruby convention that most Ruby developers are used to makes it easy to find the files and classes on our codebase.

The Ruby Convention states:

hello.rb -> class or module Hello
helloworld.rb -> class or module Helloworld
hello_world.rb -> class or module HelloWorld
hello/world.rb -> class or module Hello::World

I excluded specific files to avoid having to do a big rename. For example, to have a class name be OpenTelemtry, we would need the filename or directory to be open_telemetry.
Those changes make looking at the git history hard and might not provide much value.

Also, specific names in the industry will not match the ruby convention, such as MongoDB.

I added all the reasonable configurations to this cop and added the list of files that need to change in .rubocop_todo.yml.

That way, this PR only makes sure that no new files that not follow the ruby convention can be added to the repository, as well as having a list of files to slowly change 😄

What does this PR do?

Motivation:

Additional Notes:

How to test the change?

For Datadog employees:

  • If this PR touches code that signs or publishes builds or packages, or handles
    credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

Unsure? Have a question? Request a review!

@GustavoCaso GustavoCaso requested a review from a team as a code owner September 25, 2023 14:28
@GustavoCaso GustavoCaso requested a review from marcotc September 25, 2023 14:29
Copy link
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@GustavoCaso GustavoCaso force-pushed the force-file-name-match-class-name branch 2 times, most recently from 2e8c023 to c0313ec Compare September 25, 2023 19:57
@github-actions github-actions bot added the core Involves Datadog core libraries label Sep 25, 2023
By following the Ruby convention that most Ruby developers are used to,
makes it easy to find the files and classes on our codebase.

I excluded certain files to avoid having to do a big rename.
For example to have a class name be OpenTelemtry we would
need the filename or directory be open_telemetry.
Those changes makes looking at the git history hard, and the might not
provide a lot of value.

Also, there are certain names in the industry that will not match the ruby
conventition such as MongoDB.
@GustavoCaso GustavoCaso force-pushed the force-file-name-match-class-name branch from c0313ec to dcef8da Compare September 26, 2023 08:19
@GustavoCaso GustavoCaso merged commit bdb127e into master Sep 26, 2023
176 checks passed
@GustavoCaso GustavoCaso deleted the force-file-name-match-class-name branch September 26, 2023 08:48
@github-actions github-actions bot added this to the 1.15.0 milestone Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants