Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
inherit_from: .rubocop_todo.yml

plugins:
- rubocop-performance
- rubocop-rake
- rubocop-rspec

AllCops:
NewCops: enable
25 changes: 7 additions & 18 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-02-02 08:32:23 -0800 using RuboCop version 0.52.1.
# on 2025-02-28 11:06:05 UTC using RuboCop version 1.73.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'atomos.gemspec'

# Offense count: 1
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 14

# Offense count: 1
# Configuration parameters: AllowedConstants.
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'lib/atomos.rb'

# Offense count: 7
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 97
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Style/IfUnlessModifier:
Exclude:
- 'lib/atomos.rb'
8 changes: 8 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# Specify your gem's dependencies in atomos.gemspec
gemspec

gem 'bundler'
gem 'rake'
gem 'rspec', '~> 3.0'
gem 'rubocop'
gem 'rubocop-performance', '~> 1.24'
gem 'rubocop-rake', '~> 0.7.1'
gem 'rubocop-rspec', '~> 3.5'
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ GEM
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.1)
parser (>= 3.3.1.0)
rubocop-performance (1.24.0)
lint_roller (~> 1.1)
rubocop (>= 1.72.1, < 2.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-rake (0.7.1)
lint_roller (~> 1.1)
rubocop (>= 1.72.1)
rubocop-rspec (3.5.0)
lint_roller (~> 1.1)
rubocop (~> 1.72, >= 1.72.1)
ruby-progressbar (1.9.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
Expand All @@ -65,6 +75,9 @@ DEPENDENCIES
rake
rspec (~> 3.0)
rubocop
rubocop-performance (~> 1.24)
rubocop-rake (~> 0.7.1)
rubocop-rspec (~> 3.5)

BUNDLED WITH
2.6.3
5 changes: 1 addition & 4 deletions atomos.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 3.1'

spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.0'
spec.add_development_dependency 'rubocop'
spec.metadata['rubygems_mfa_required'] = 'true'
end
6 changes: 2 additions & 4 deletions bin/rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 150).match?(/This file was generated by Bundler/)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Expand Down
6 changes: 2 additions & 4 deletions bin/rspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 150).match?(/This file was generated by Bundler/)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Expand Down
6 changes: 2 additions & 4 deletions bin/rubocop
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
Pathname.new(__FILE__).realpath)
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)

bundle_binstub = File.expand_path('bundle', __dir__)

if File.file?(bundle_binstub)
if File.read(bundle_binstub, 150).match?(/This file was generated by Bundler/)
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Expand Down
5 changes: 3 additions & 2 deletions spec/atomos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

RSpec.describe Atomos do
let(:tmpdir) { Dir.mktmpdir }
after { FileUtils.remove_entry tmpdir }
let(:target) { File.join(tmpdir, 'target') }

after { FileUtils.remove_entry tmpdir }

it 'has a version number' do
expect(Atomos::VERSION).not_to be_nil
end
Expand All @@ -18,7 +19,7 @@
end

it 'raises when both contents and block are given' do
expect { described_class.atomic_write('true', 'false') { |_f| } }
expect { described_class.atomic_write('true', 'false') { |_f| raise } }
.to raise_error ArgumentError
end

Expand Down