Skip to content

Commit

Permalink
Merge pull request #81 from halostatue/switch-to-standardrb-formatting
Browse files Browse the repository at this point in the history
Switch to standardrb formatting
  • Loading branch information
halostatue committed Jul 5, 2022
2 parents 3062997 + 0270cb8 commit cab33a9
Show file tree
Hide file tree
Showing 29 changed files with 937 additions and 887 deletions.
5 changes: 2 additions & 3 deletions .fasterer.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
exclude_paths:
- lib/diff/lcs.rb # sort_vs_sort_by on priority_compare
- Rakefile # each_with_index vs while
- spec/spec_helper.rb
- research/**/*
- pkg/**/*
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ master, main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, main ]
branches: [main]
schedule:
- cron: '28 4 * * 2'

Expand All @@ -32,39 +32,39 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'ruby' ]
language: ['ruby']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
6 changes: 6 additions & 0 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
parallel: true
ruby_version: 2.0
ignore:
- 'diff-lcs.gemspec'
- 'research/**/*'
- 'pkg/**/*'
24 changes: 14 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
# NOTE: This file is present to keep Travis CI happy. Edits to it will not
# be accepted.

source 'https://rubygems.org/'
source "https://rubygems.org/"

if RUBY_VERSION < '1.9'
gem 'hoe', '~> 3.20'
gem 'rake', '< 11'
gem 'rdoc', '< 4'
if RUBY_VERSION < "1.9"
gem "hoe", "~> 3.20"
gem "rake", "< 11"
gem "rdoc", "< 4"

gem 'ruby-debug'
elsif RUBY_VERSION >= '2.0'
if RUBY_ENGINE == 'ruby'
gem 'simplecov', '~> 0.18'
gem "ruby-debug"
end

if RUBY_VERSION >= "2.0"
gem "standardrb"
gem "fasterer"

gem 'byebug'
if RUBY_ENGINE == "ruby"
gem "simplecov", "~> 0.18"
gem "byebug"
end
end

Expand Down
2 changes: 2 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Updated the CI configuration, resolving [#82][].

- Switched to standard ruby formatting.

## 1.5.0 / 2021-12-23

- Updated the CI configuration and monkey-patch Hoe.
Expand Down
60 changes: 33 additions & 27 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

require 'rubygems'
require 'rspec'
require 'rspec/core/rake_task'
require 'hoe'
require "rubygems"
require "rspec"
require "rspec/core/rake_task"
require "hoe"

# This is required until https://github.com/seattlerb/hoe/issues/112 is fixed
class Hoe
Expand Down Expand Up @@ -45,66 +45,71 @@ Hoe.plugin :doofus
Hoe.plugin :gemspec2
Hoe.plugin :git

if RUBY_VERSION < '1.9'
class Array #:nodoc:
if RUBY_VERSION < "1.9"
class Array # :nodoc:
def to_h
Hash[*flatten(1)]
end
end

class Gem::Specification #:nodoc:
def metadata=(*); end
class Gem::Specification # :nodoc:
def metadata=(*)
end

def default_value(*); end
def default_value(*)
end
end

class Object #:nodoc:
class Object # :nodoc:
def caller_locations(*)
[]
end
end
end

_spec = Hoe.spec 'diff-lcs' do
developer('Austin Ziegler', 'halostatue@gmail.com')
_spec = Hoe.spec "diff-lcs" do
developer("Austin Ziegler", "halostatue@gmail.com")

require_ruby_version '>= 1.8'
require_ruby_version ">= 1.8"

self.history_file = 'History.md'
self.readme_file = 'README.rdoc'
self.licenses = ['MIT', 'Artistic-2.0', 'GPL-2.0+']
self.history_file = "History.md"
self.readme_file = "README.rdoc"
self.licenses = ["MIT", "Artistic-2.0", "GPL-2.0+"]

extra_dev_deps << ['hoe-doofus', '~> 1.0']
extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
extra_dev_deps << ['hoe-git', '~> 1.6']
extra_dev_deps << ['hoe-rubygems', '~> 1.0']
extra_dev_deps << ['rspec', '>= 2.0', '< 4']
extra_dev_deps << ['rake', '>= 10.0', '< 14']
extra_dev_deps << ['rdoc', '>= 6.3.1', '< 7']
extra_dev_deps << ["hoe-doofus", "~> 1.0"]
extra_dev_deps << ["hoe-gemspec2", "~> 1.1"]
extra_dev_deps << ["hoe-git", "~> 1.6"]
extra_dev_deps << ["hoe-rubygems", "~> 1.0"]
extra_dev_deps << ["rspec", ">= 2.0", "< 4"]
extra_dev_deps << ["rake", ">= 10.0", "< 14"]
extra_dev_deps << ["rdoc", ">= 6.3.1", "< 7"]
end

desc "Run all specifications"
RSpec::Core::RakeTask.new(:spec) do |t|
rspec_dirs = %w(spec lib).join(":")
rspec_dirs = %w[spec lib].join(":")
t.rspec_opts = ["-I#{rspec_dirs}"]
end

Rake::Task["spec"].actions.uniq! { |a| a.source_location }

# standard:disable Style/HashSyntax
task :default => :spec unless Rake::Task["default"].prereqs.include?("spec")
task :test => :spec unless Rake::Task["test"].prereqs.include?("spec")
# standard:enable Style/HashSyntax

if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby'
if RUBY_VERSION >= "2.0" && RUBY_ENGINE == "ruby"
namespace :spec do
desc "Runs test coverage. Only works Ruby 2.0+ and assumes 'simplecov' is installed."
task :coverage do
ENV['COVERAGE'] = 'yes'
Rake::Task['spec'].execute
ENV["COVERAGE"] = "yes"
Rake::Task["spec"].execute
end
end
end

task :ruby18 do
# standard:disable Layout/HeredocIndentation
puts <<-MESSAGE
You are starting a barebones Ruby 1.8 docker environment. You will need to
do the following:
Expand All @@ -117,5 +122,6 @@ do the following:
Don't forget to restore your Gemfile.lock after testing.
MESSAGE
# standard:enable Layout/HeredocIndentation
sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
end
8 changes: 4 additions & 4 deletions bin/htmldiff
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#! /usr/bin/env ruby -w
# frozen_string_literal: true

require 'diff/lcs'
require 'diff/lcs/htmldiff'
require "diff/lcs"
require "diff/lcs/htmldiff"

begin
require 'text/format'
require "text/format"
rescue LoadError
Diff::LCS::HTMLDiff.can_expand_tabs = false
end
Expand All @@ -24,7 +24,7 @@ options = { :title => "diff #{ARGV[0]} #{ARGV[1]}" }
htmldiff = Diff::LCS::HTMLDiff.new(left, right, options)

if ARGV[2]
File.open(ARGV[2], 'w') do |f|
File.open(ARGV[2], "w") do |f|
htmldiff.options[:output] = f
htmldiff.run
end
Expand Down
2 changes: 1 addition & 1 deletion lib/diff-lcs.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

require 'diff/lcs'
require "diff/lcs"
Loading

0 comments on commit cab33a9

Please sign in to comment.