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

Remove Copyright specs #32

Merged
merged 1 commit into from Jan 18, 2024
Merged

Conversation

m-nakamura145
Copy link

I ran the following test today and it failed; I will correct the year in Copyright.

Before

❯ bundle exec rspec spec/license_spec.rb
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 62370
.FF

Failures:

  1) the LICENSE contains a copyright statement for the current year
     Failure/Error: expect(license.read).to match(/Copyright 2016-#{Date.today.year}/)

       expected "Portions Copyright 2016-2023 Michael Gee and contributors\nPortions Copyright 2016-2022 CoverMyMeds\...ING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" to match /Copyright 2016-2024/
       Diff:
       @@ -1,8 +1,15 @@
       -/Copyright 2016-2024/
       +Portions Copyright 2016-2023 Michael Gee and contributors
       +Portions Copyright 2016-2022 CoverMyMeds
       +
       +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
       +
       +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
       +
       +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

     # ./spec/license_spec.rb:13:in `block (2 levels) in <top (required)>'

  2) the LICENSE is referenced from the README
     Failure/Error:
       expect(readme).to match(
         /Copyright .* 2016-#{Date.today.year}.*LICENSE.txt/m
       )

       expected "# RuboCop::ThreadSafety\n\nThread-safety analysis for your projects, as an extension to\n[RuboCop](h...tions Copyright (c) 2016-2023 CoverMyMeds.\n\nSee [LICENSE.txt](LICENSE.txt) for further details.\n" to match /Copyright .* 2016-2024.*LICENSE.txt/m
       Diff:
       @@ -1,78 +1,155 @@
       -/Copyright .* 2016-2024.*LICENSE.txt/m
       +# RuboCop::ThreadSafety
       +
       +Thread-safety analysis for your projects, as an extension to
       +[RuboCop](https://github.com/bbatsov/rubocop).
       +
       +## Installation and Usage
       +
       +### Installation into an application
       +
       +Add this line to your application's Gemfile (using `require: false` as it's a standalone tool):
       +
       +```ruby
       +gem 'rubocop-thread_safety', require: false
       +```
       +
       +Install it with Bundler by invoking:
       +
       +    $ bundle
       +
       +Add this line to your application's `.rubocop.yml`:
       +
       +    require: rubocop-thread_safety
       +
       +Now you can run `rubocop` and it will automatically load the RuboCop
       +Thread-Safety cops together with the standard cops.
       +
       +### Scanning an application without adding it to the Gemfile
       +
       +Install the gem:
       +
       +    $ gem install rubocop-thread_safety
       +
       +Scan the application for just thread-safety issues:
       +
       +    $ rubocop -r rubocop-thread_safety --only ThreadSafety,Style/GlobalVars,Style/ClassVars,Style/MutableConstant
       +
       +### Configuration
       +
       +There are some added [configuration options](https://github.com/rubocop/rubocop-thread_safety/blob/master/config/default.yml) that can be tweaked to modify the behaviour of these thread-safety cops.
       +
       +### Correcting code for thread-safety
       +
       +There are a few ways to improve thread-safety that stem around avoiding
       +unsynchronized mutation of state that is shared between multiple threads.
       +
       +State shared between threads may take various forms, including:
       +
       +* Class variables (`@@name`). Note: these affect child classes too.
       +* Class instance variables (`@name` in class context or class methods)
       +* Constants (`NAME`). Ruby will warn if a constant is re-assigned to a new value but will allow it. Mutable objects can still be mutated (e.g. push to an array) even if they are assigned to a constant.
       +* Globals (`$name`), with the possible exception of some special globals provided by ruby that are documented as thread-local like regular expression results.
       +* Variables in the scope of created threads (where `Thread.new` is called).
       +
       +Improvements that would make shared state thread-safe include:
       +
       +* `freeze` objects to protect against mutation. Note: `freeze` is shallow, i.e. freezing an array will not also freeze its elements.
       +* Use data structures or concurrency abstractions from [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby), e.g. `Concurrent::Map`
       +* Use a `Mutex` or similar to `synchronize` access.
       +* Use [`ActiveSupport::CurrentAttributes`](https://api.rubyonrails.org/classes/ActiveSupport/CurrentAttributes.html)
       +* Use [`RequestStore`](https://github.com/steveklabnik/request_store)
       +* Use `Thread.current[:name]`
       +
       +## Development
       +
       +After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
       +
       +To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
       +
       +## Contributing
       +
       +Bug reports and pull requests are welcome on GitHub at https://github.com/rubocop/rubocop-thread_safety.
       +
       +## Copyright
       +
       +Portions Copyright (c) 2016-2023 Michael Gee and [contributors](https://github.com/rubocop/rubocop-thread_safety/graphs/contributors).
       +Portions Copyright (c) 2016-2023 CoverMyMeds.
       +
       +See [LICENSE.txt](LICENSE.txt) for further details.

     # ./spec/license_spec.rb:18:in `block (2 levels) in <top (required)>'

Finished in 0.01 seconds (files took 0.80013 seconds to load)
3 examples, 2 failures

Failed examples:

rspec ./spec/license_spec.rb:12 # the LICENSE contains a copyright statement for the current year
rspec ./spec/license_spec.rb:16 # the LICENSE is referenced from the README

Randomized with seed 62370

After

~/work/rubocop-thread_safety fix-license_spec
❯ bundle exec rspec spec/license_spec.rb
Run options: include {:focus=>true}

All examples were filtered out; ignoring {:focus=>true}

Randomized with seed 3408
...

Finished in 0.00202 seconds (files took 0.82158 seconds to load)
3 examples, 0 failures

Randomized with seed 3408

Copy link
Collaborator

@mikegee mikegee left a comment

Choose a reason for hiding this comment

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

Sorry about the unusual copyright situation but CoverMyMeds' stewardship of this project ended in 2022.

Backstory: I created this as part of my job there, but left and forked out of their GH organization.

Is this spec weird? It causes a minor annoyance every year. Maybe we should delete it instead?

@m-nakamura145
Copy link
Author

@mikegee Thank you! I agree with your opinion. I have removed the relevant test cases.
50eac98

@m-nakamura145 m-nakamura145 changed the title Update Copyright year Remove Copyright specs Jan 18, 2024
Copy link
Collaborator

@mikegee mikegee left a comment

Choose a reason for hiding this comment

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

Thanks!

@mikegee mikegee merged commit 2ce2dd9 into rubocop:master Jan 18, 2024
22 of 23 checks passed
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.

None yet

2 participants