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

Should we mark some modules as private before v1? #8278

Closed
marcandre opened this issue Jul 8, 2020 · 10 comments
Closed

Should we mark some modules as private before v1? #8278

marcandre opened this issue Jul 8, 2020 · 10 comments
Assignees
Milestone

Comments

@marcandre
Copy link
Contributor

When reviewing #8274 I realized that it might be a good idea to mark some internal modules and classes as "@api private" before v1. Or is that too late or futile?

@deivid-rodriguez
Copy link
Contributor

I believe it's good idea. If a whole review of all modules and classes is deemed like it would delay the release too much, at least mark those modules where privateness is straightforward. It might flexibilize future refactorings :)

@marcandre marcandre added this to the 1.0.0 milestone Jul 9, 2020
@marcandre
Copy link
Contributor Author

@bbatsov should I work into this?

@bbatsov
Copy link
Collaborator

bbatsov commented Jul 9, 2020

Yeah, that's a good idea.

@marcandre marcandre self-assigned this Jul 9, 2020
pirj added a commit to rubocop/rubocop-rspec that referenced this issue Aug 2, 2020
RuboCop 1.0 might come with breaking API changes rubocop/rubocop#8278

Limit pre-2.0 RuboCop RSpec versions to RuboCop >= 0.87, < 1.0
@pirj
Copy link
Member

pirj commented Aug 9, 2020

Makes total sense: if not done otherwise, we'll have to refrain from refactoring and keep all the internals intact to avoid breakages in custom extensions using this internals directly. At least until we hit 2.0, in ~year from now.

I was thinking of adding a suffix to all methods and running well-known extensions against this. All the breakages will remain in the public API, all the rest can be made private and/or marked as such.

Do you want me to tackle this?

@pirj
Copy link
Member

pirj commented Aug 9, 2020

Actually, @jonatas, it seems to be a great way to do with ffast. Unfortunately, I don't have much experience with using it. Would you give it a shot?

@marcandre
Copy link
Contributor Author

marcandre commented Aug 9, 2020

I pushed my branch as #8278, I made some progress but didn't quite finish...

@marcandre
Copy link
Contributor Author

I was thinking of adding a suffix to all methods

I'm 👎 on that. It makes the codebase ugly. For anyone already using our "private" methods, that's instant breakage when it might never have to break.

@pirj
Copy link
Member

pirj commented Aug 9, 2020

It makes the codebase ugly.

Sorry, I didn't express myself clearly. We do this temporarily, to separate those that are never used by well-known extensions.

If we only mark what is an internal implementation detail with @api private and don't make it private, we postpone the problem. When we refactor, it will break extensions somewhere between 1.0 and 2.0.

I would personally prefer it to break earlier to avoid gem 'rubocop', '~> 1.0', '< 1.3' dance. For the end-users it means they won't be able to bump, e.g. rubocop-rails separately from rubocop-minitest, because one depends on < 1.3, and another on >= 1.3.

@marcandre
Copy link
Contributor Author

We do this temporarily

Ah! Sure, for known "clients" that could be worthwhile to discover issues.

marcandre added a commit to marcandre/rubocop that referenced this issue Aug 27, 2020
Many internal Modules and Classes marked as private.
Severity marked as public
@mergify mergify bot closed this as completed in 36742ea Aug 27, 2020
@jonatas
Copy link
Contributor

jonatas commented Aug 28, 2020

Ouch! sorry for being late here @pirj, the idea is very simple through the Fastfile.

I didn't test but it would be something like:

Fast.shortcut(:mark_api_private) do
  ruby_files_from(ARGV.last) do |file|
    replace_all('class', file) do |node|
       insert_before(node.loc.expression, "# @api private\n")
    end
  end
end

and then execute fast .mark_api_private path/with/ruby/files

But looking the PR probably it would make some failures as we have several mixes of inner classes with modules.

pirj added a commit to rubocop/rubocop-capybara that referenced this issue Dec 29, 2022
RuboCop 1.0 might come with breaking API changes rubocop/rubocop#8278

Limit pre-2.0 RuboCop RSpec versions to RuboCop >= 0.87, < 1.0
ydah pushed a commit to rubocop/rubocop-factory_bot that referenced this issue Apr 13, 2023
RuboCop 1.0 might come with breaking API changes rubocop/rubocop#8278

Limit pre-2.0 RuboCop RSpec versions to RuboCop >= 0.87, < 1.0
ydah pushed a commit to rubocop/rubocop-rspec_rails that referenced this issue Mar 27, 2024
RuboCop 1.0 might come with breaking API changes rubocop/rubocop#8278

Limit pre-2.0 RuboCop RSpec versions to RuboCop >= 0.87, < 1.0
ydah pushed a commit to rubocop/rubocop-rspec_rails that referenced this issue Mar 27, 2024
RuboCop 1.0 might come with breaking API changes rubocop/rubocop#8278

Limit pre-2.0 RuboCop RSpec versions to RuboCop >= 0.87, < 1.0
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

No branches or pull requests

5 participants