diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 17532bdd..711bddf3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,13 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: Swatinem/rust-cache@v2 - - uses: taiki-e/install-action@v2 with: tool: selene,typos-cli - - name: Run linters run: make lint @@ -32,3 +29,13 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} version: latest args: --color always --check lua/ tests/ + + ruby_lint: + name: Rubocop + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - run: bundle exec rubocop diff --git a/.rubocop.yml b/.rubocop.yml index 21f6c734..52c146b0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,3 +5,13 @@ AllCops: TargetRubyVersion: 3.3.1 Style/StringLiterals: EnforcedStyle: double_quotes +RSpec/DescribeClass: + Enabled: false +RSpec/MultipleExpectations: + Enabled: false +RSpec/ExampleLength: + Enabled: false +RSpec/NestedGroups: + Enabled: false +Style/NestedModifier: + Enabled: false diff --git a/spec/popups/branch_popup_spec.rb b/spec/popups/branch_popup_spec.rb index 4e6d6d84..5585f635 100644 --- a/spec/popups/branch_popup_spec.rb +++ b/spec/popups/branch_popup_spec.rb @@ -116,9 +116,7 @@ RSpec.describe "Branch Popup", :git, :nvim do end describe "Create new branch" do - it "can create a new branch" do - - end + it "can create a new branch" end describe "Create new spin-off" do @@ -150,6 +148,7 @@ RSpec.describe "Branch Popup", :git, :nvim do end describe "pull request" do + it "can open a pull-request" end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 37df0183..586c73d8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -29,7 +29,7 @@ RSpec.configure do |config| config.include Helpers - config.around(:each) do |example| + config.around do |example| with_remote = example.metadata.fetch(:with_remote_origin, false) Dir.mktmpdir do |local| diff --git a/spec/support/context/git.rb b/spec/support/context/git.rb index a3191723..d9576b7d 100644 --- a/spec/support/context/git.rb +++ b/spec/support/context/git.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.shared_context "git", :git do +RSpec.shared_context "with git", :git do let(:git) { Git.open(Dir.pwd) } before do diff --git a/spec/support/context/nvim.rb b/spec/support/context/nvim.rb index 4dd80823..a7e4e0e0 100644 --- a/spec/support/context/nvim.rb +++ b/spec/support/context/nvim.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.shared_context "nvim", :nvim do +RSpec.shared_context "with nvim", :nvim do let(:nvim) { NeovimClient.new } before { nvim.setup } diff --git a/spec/support/dependencies.rb b/spec/support/dependencies.rb index 491ec299..eb129121 100644 --- a/spec/support/dependencies.rb +++ b/spec/support/dependencies.rb @@ -3,12 +3,12 @@ return if ENV["CI"] def dir_name(name) - name.match(/[^\/]+\/(?[^\.]+)/)[:dir_name] + name.match(%r{[^/]+/(?[^\.]+)})[:dir_name] end def ensure_installed(name) tmp = File.join(PROJECT_DIR, "tmp") - Dir.mkdir(tmp) if !Dir.exist?(tmp) + FileUtils.mkdir_p(tmp) dir = File.join(tmp, dir_name(name)) diff --git a/spec/support/neovim_client.rb b/spec/support/neovim_client.rb index f86b2b59..bf940a3e 100644 --- a/spec/support/neovim_client.rb +++ b/spec/support/neovim_client.rb @@ -5,7 +5,7 @@ class NeovimClient @instance = nil end - def setup + def setup # rubocop:disable Metrics/MethodLength @instance = attach_child # Sets up the runtimepath @@ -30,7 +30,7 @@ class NeovimClient @instance = nil end - def print_screen + def print_screen # rubocop:disable Metrics/MethodLength @instance.command("redraw") screen = [] @@ -63,7 +63,7 @@ class NeovimClient # Overload vim.fn.input() to prevent blocking. def input(*args) lua <<~LUA - local inputs = { #{args.map(&:inspect).join(",")} } + local inputs = { #{args.map(&:inspect).join(',')} } vim.fn.input = function() return table.remove(inputs, 1) @@ -71,16 +71,14 @@ class NeovimClient LUA end - def keys(keys) + def keys(keys) # rubocop:disable Metrics/MethodLength keys = keys.chars - while keys.length > 0 + until keys.empty? key = keys.shift - if key == "<" - key += keys.shift until key.last == ">" - end + key += keys.shift until key.last == ">" if key == "<" - if (written = @instance.input(key)).nil? + if @instance.input(key).nil? assert_alive! raise "Failed to write key to neovim: #{key.inspect}" end