repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot.rb | lib/rspec/snapshot.rb | # frozen_string_literal: true
require 'rspec'
require 'rspec/snapshot/version'
require 'rspec/snapshot/configuration'
require 'rspec/snapshot/matchers'
| ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot/default_serializer.rb | lib/rspec/snapshot/default_serializer.rb | # frozen_string_literal: true
require 'awesome_print'
module RSpec
module Snapshot
# Serializes values in a human readable way for snapshots using the
# awesome_print gem
class DefaultSerializer
# @param [*] value The value to serialize.
# @return [String] The serialized value.
def dum... | ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot/version.rb | lib/rspec/snapshot/version.rb | # frozen_string_literal: true
module RSpec
module Snapshot
VERSION = '2.0.3'
end
end
| ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot/matchers.rb | lib/rspec/snapshot/matchers.rb | # frozen_string_literal: true
require 'rspec/snapshot/matchers/match_snapshot'
require 'rspec/snapshot/file_operator'
require 'rspec/snapshot/serializer_factory'
module RSpec
module Snapshot
# rubocop:disable Style/Documentation
module Matchers
def match_snapshot(snapshot_name, config = {})
Ma... | ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot/file_operator.rb | lib/rspec/snapshot/file_operator.rb | # frozen_string_literal: true
require 'fileutils'
module RSpec
module Snapshot
# Handles File IO for snapshots
class FileOperator
# Initializes the class instance, and creates the snapshot directory for
# the current test if needed.
#
# @param [String] snapshot_name The name of the s... | ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot/serializer_factory.rb | lib/rspec/snapshot/serializer_factory.rb | # frozen_string_literal: true
require 'rspec/snapshot/default_serializer'
module RSpec
module Snapshot
# Uses the factory pattern to initialize a snapshot serializer.
class SerializerFactory
def initialize(config = {})
@config = config
end
# @returns [#dump] A serializer object wh... | ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot/configuration.rb | lib/rspec/snapshot/configuration.rb | # frozen_string_literal: true
module RSpec
# rubocop:disable Style/Documentation
module Snapshot
class Configuration
def self.initialize_configuration(config)
config.add_setting :snapshot_dir, default: :relative
config.add_setting :snapshot_serializer, default: nil
end
end
... | ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
levinmr/rspec-snapshot | https://github.com/levinmr/rspec-snapshot/blob/5c1212ca0502de1555d8b3e1af6ab8bd74782cb9/lib/rspec/snapshot/matchers/match_snapshot.rb | lib/rspec/snapshot/matchers/match_snapshot.rb | # frozen_string_literal: true
module RSpec
module Snapshot
module Matchers
# RSpec matcher for snapshot testing
class MatchSnapshot
attr_reader :actual, :expected
# @param [#dump] serializer A class instance which responds to #dump to
# convert test values to string for writi... | ruby | MIT | 5c1212ca0502de1555d8b3e1af6ab8bd74782cb9 | 2026-01-04T17:32:54.285296Z | false |
microsoft/cocoapods-pod-linkage | https://github.com/microsoft/cocoapods-pod-linkage/blob/d7364e7d759c341dacb2fb42b87dd04917be28f9/spec/spec_helper.rb | spec/spec_helper.rb | require 'pathname'
ROOT = Pathname.new(File.expand_path('../../', __FILE__))
$:.unshift((ROOT + 'lib').to_s)
$:.unshift((ROOT + 'spec').to_s)
require 'bundler/setup'
require 'cocoapods'
RSpec.configure do |config|
config.mock_with :mocha
config.expect_with :rspec do |c|
c.syntax = :expect
end
end
Mocha.co... | ruby | MIT | d7364e7d759c341dacb2fb42b87dd04917be28f9 | 2026-01-04T17:33:01.509400Z | false |
microsoft/cocoapods-pod-linkage | https://github.com/microsoft/cocoapods-pod-linkage/blob/d7364e7d759c341dacb2fb42b87dd04917be28f9/spec/cocoapods-pod-linkage/target_definition_spec.rb | spec/cocoapods-pod-linkage/target_definition_spec.rb | require 'spec_helper'
module Pod
describe Podfile::TargetDefinition do
before do
@podfile = Podfile.new
@root = Podfile::TargetDefinition.new('Pods', @podfile)
@parent = Podfile::TargetDefinition.new('MyApp', @root)
@child = Podfile::TargetDefinition.new('MyAppTests', @parent)
end
... | ruby | MIT | d7364e7d759c341dacb2fb42b87dd04917be28f9 | 2026-01-04T17:33:01.509400Z | false |
microsoft/cocoapods-pod-linkage | https://github.com/microsoft/cocoapods-pod-linkage/blob/d7364e7d759c341dacb2fb42b87dd04917be28f9/spec/cocoapods-pod-linkage/analyzer_spec.rb | spec/cocoapods-pod-linkage/analyzer_spec.rb | require 'spec_helper'
module Pod
describe Installer::Analyzer do
before do
@podfile = Podfile.new
@root = Podfile::TargetDefinition.new('Pods', @podfile)
@parent = Podfile::TargetDefinition.new('MyApp', @root)
@sandbox = mock()
@analyzer = Installer::Analyzer.new(@sandbox, @podfil... | ruby | MIT | d7364e7d759c341dacb2fb42b87dd04917be28f9 | 2026-01-04T17:33:01.509400Z | false |
microsoft/cocoapods-pod-linkage | https://github.com/microsoft/cocoapods-pod-linkage/blob/d7364e7d759c341dacb2fb42b87dd04917be28f9/lib/cocoapods_plugin.rb | lib/cocoapods_plugin.rb | require 'cocoapods-pod-linkage'
| ruby | MIT | d7364e7d759c341dacb2fb42b87dd04917be28f9 | 2026-01-04T17:33:01.509400Z | false |
microsoft/cocoapods-pod-linkage | https://github.com/microsoft/cocoapods-pod-linkage/blob/d7364e7d759c341dacb2fb42b87dd04917be28f9/lib/cocoapods-pod-linkage.rb | lib/cocoapods-pod-linkage.rb | require 'cocoapods-pod-linkage/gem_version'
require 'cocoapods-pod-linkage/patched_analyzer'
| ruby | MIT | d7364e7d759c341dacb2fb42b87dd04917be28f9 | 2026-01-04T17:33:01.509400Z | false |
microsoft/cocoapods-pod-linkage | https://github.com/microsoft/cocoapods-pod-linkage/blob/d7364e7d759c341dacb2fb42b87dd04917be28f9/lib/cocoapods-pod-linkage/patched_analyzer.rb | lib/cocoapods-pod-linkage/patched_analyzer.rb | require 'cocoapods'
class Pod::Installer::Analyzer
alias_method :original_generate_pod_targets, :generate_pod_targets
def generate_pod_targets(resolver_specs_by_target, target_inspections)
targets = original_generate_pod_targets(resolver_specs_by_target, target_inspections)
pod_targets = []
... | ruby | MIT | d7364e7d759c341dacb2fb42b87dd04917be28f9 | 2026-01-04T17:33:01.509400Z | false |
microsoft/cocoapods-pod-linkage | https://github.com/microsoft/cocoapods-pod-linkage/blob/d7364e7d759c341dacb2fb42b87dd04917be28f9/lib/cocoapods-pod-linkage/gem_version.rb | lib/cocoapods-pod-linkage/gem_version.rb | module CocoapodsPodLinkage
VERSION = "0.0.1"
end
| ruby | MIT | d7364e7d759c341dacb2fb42b87dd04917be28f9 | 2026-01-04T17:33:01.509400Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean_spec.rb | spec/digitalocean_spec.rb | require 'spec_helper'
describe Digitalocean do
subject(:digitalocean) { described_class }
before do
digitalocean.client_id = client_id
digitalocean.api_key = api_key
digitalocean.verify_ssl = verify_ssl
end
describe "defaults" do
let(:client_id) { nil }
let(:api_key) { nil}
let(... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/spec_helper.rb | spec/spec_helper.rb | require 'rubygems'
require 'bundler/setup'
require 'pry'
require 'digitalocean'
require 'securerandom'
require 'rspec/its'
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
| ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/record_spec.rb | spec/digitalocean/record_spec.rb | require 'spec_helper'
describe Digitalocean::Record do
subject(:record) { described_class }
describe "._all" do
let(:domain_id) { "100" }
let(:url) { record._all(domain_id) }
it { url.should eq "https://api.digitalocean.com/v1/domains/#{domain_id}/records?client_id=client_id_required&api_key=api_key_... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/size_spec.rb | spec/digitalocean/size_spec.rb | require 'spec_helper'
describe Digitalocean::Size do
subject(:size) { described_class }
describe "._all" do
let(:url) { size._all }
it { url.should eq "https://api.digitalocean.com/v1/sizes/?client_id=client_id_required&api_key=api_key_required" }
end
describe "._find" do
let(:size_id) { "1234" ... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/droplet_spec.rb | spec/digitalocean/droplet_spec.rb | require 'spec_helper'
describe Digitalocean::Droplet do
subject(:droplet) { described_class }
describe "._all" do
let(:url) { droplet._all }
it { url.should eq "https://api.digitalocean.com/v1/droplets/?client_id=client_id_required&api_key=api_key_required" }
end
describe "._find" do
let(:droplet... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/integration_spec.rb | spec/digitalocean/integration_spec.rb | require 'spec_helper'
describe "integrations" do
subject(:region) { Digitalocean::Region }
before { Digitalocean.send(:setup_request!) }
it "makes a real call" do
regions = region.all
regions.status.should eq "ERROR"
end
end
| ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/domain_spec.rb | spec/digitalocean/domain_spec.rb | require 'spec_helper'
describe Digitalocean::Domain do
subject(:domain) { described_class }
describe "._all" do
let(:url) { domain._all }
it { url.should eq "https://api.digitalocean.com/v1/domains?client_id=client_id_required&api_key=api_key_required" }
end
describe "._find" do
let(:domain_id) {... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/region_spec.rb | spec/digitalocean/region_spec.rb | require 'spec_helper'
describe Digitalocean::Region do
subject(:region) { described_class }
describe "._all" do
let(:url) { region._all }
it { url.should eq "https://api.digitalocean.com/v1/regions/?client_id=client_id_required&api_key=api_key_required" }
end
describe "._find" do
let(:region_id)... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/ssh_key_spec.rb | spec/digitalocean/ssh_key_spec.rb | require 'spec_helper'
describe Digitalocean::SshKey do
subject(:ssh_key) { described_class }
describe "._all" do
let(:url) { ssh_key._all }
it { url.should eq "https://api.digitalocean.com/v1/ssh_keys/?client_id=client_id_required&api_key=api_key_required" }
end
describe "._find" do
let(:ssh_ke... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/image_spec.rb | spec/digitalocean/image_spec.rb | require 'spec_helper'
describe Digitalocean::Image do
subject(:image) { described_class }
describe "._all" do
let(:url) { image._all }
it { url.should eq "https://api.digitalocean.com/v1/images/?client_id=client_id_required&api_key=api_key_required" }
end
describe "._all with optional parameters" do
... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/spec/digitalocean/event_spec.rb | spec/digitalocean/event_spec.rb | require 'spec_helper'
describe Digitalocean::Event do
subject(:event) { described_class }
describe "._find" do
let(:event_id) { "1234" }
let(:url) { event._find(event_id) }
it { url.should eq "https://api.digitalocean.com/v1/events/#{event_id}/?client_id=client_id_required&api_key=api_key_required" }... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/lib/digitalocean.rb | lib/digitalocean.rb | require "faraday"
require "faraday_middleware"
require "recursive-open-struct"
require "digitalocean/version"
module Digitalocean
extend self
DEFINITIONS = {
"Domain" => {
"all" => "https://api.digitalocean.com/v1/domains?client_id=[your_client_id]&api_key=[your_api_key]",
"find" =... | ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
motdotla/digitalocean | https://github.com/motdotla/digitalocean/blob/7aee53c3183c198d23297847655cf716b97a893f/lib/digitalocean/version.rb | lib/digitalocean/version.rb | module Digitalocean
VERSION = "1.2.0"
end
| ruby | MIT | 7aee53c3183c198d23297847655cf716b97a893f | 2026-01-04T17:32:59.379845Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/.markdownlint_style.rb | .markdownlint_style.rb | # frozen_string_literal: true
rule 'MD029', style: 'ordered'
| ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_quality_checker.rb | test/unit/test_quality_checker.rb | # frozen_string_literal: true
# !/usr/bin/env ruby
require_relative 'test_helper'
# Unit test the QualityChecker class
class TestQualityChecker < MiniTest::Test
def setup_execute_mocks(command_options, num_violations, existing_violations,
minimum_threshold)
command_output_processor = ... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_quality_checker_no_ratchet.rb | test/unit/test_quality_checker_no_ratchet.rb | # frozen_string_literal: true
require_relative 'test_quality_checker'
# Unit test the QualityChecker class
class TestQualityCheckerNoRatchet < TestQualityChecker
def quality_checker_dont_ratchet
command_options = {}
num_violations = 400
existing_violations = 500
minimum_threshold = 500
get_test_... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_which.rb | test/unit/test_which.rb | # frozen_string_literal: true
require_relative 'test_helper'
# Test the Which class
class TestWhich < MiniTest::Test
let_mock :cmd, :pathext, :dirname,
:foo_potential_bin_path,
:bar_potential_bin_path,
:baz_potential_bin_path
def expect_path_queried(dirname, binpath, executable, ... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_linguist_source_file_globber_specific.rb | test/unit/test_linguist_source_file_globber_specific.rb | # frozen_string_literal: true
require_relative 'test_linguist_source_file_globber'
# Test the LinguistSourceFileGlobber class
class TestLinguistSourceFileGlobberSpecific < TestLinguistSourceFileGlobber
def test_ruby_files
globber = get_test_object { expect_breakdown_pulled }
assert_equal(['a.rb'], globber.r... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_quality_checker_ratchet.rb | test/unit/test_quality_checker_ratchet.rb | # frozen_string_literal: true
require_relative 'test_quality_checker'
# Unit test the QualityChecker class
class TestQualityCheckerRatchet < TestQualityChecker
def quality_checker_ratchet
command_options = {}
num_violations = 523
existing_violations = 524
minimum_threshold = 500
get_test_object(... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_config.rb | test/unit/test_config.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require_relative 'test_helper'
# Unit test the Config class
class TestConfig < MiniTest::Test
# Just copy and paste this in from the README
def readme_instructions(task)
# Name of quality task.
# Defaults to :quality.
task.quality_name = 'quality'
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_process.rb | test/unit/test_process.rb | # frozen_string_literal: true
# Test the ProcessRunner class
class TestProcess < MiniTest::Test
def test_run
cmd = mock('cmd')
file = mock('file')
process = get_test_object(cmd) do
@mocks[:popener].expects(:popen).with(cmd).yields(file)
end
process.run do |file_yielded|
assert_equal(f... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_runner.rb | test/unit/test_runner.rb | # frozen_string_literal: true
require_relative 'test_helper'
# Test the CommandOutputProcessor class
class TestRunner < MiniTest::Test
def all_output_files
%w[file1 file2]
end
def expect_filename_ratcheted(mocks, filename)
mocks[:count_io].expects(:read).with(filename).returns('123')
file = mock("f... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_helper.rb | test/unit/test_helper.rb | # frozen_string_literal: true
require 'simplecov'
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter,
]
)
SimpleCov.s... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_linguist_source_file_globber_general.rb | test/unit/test_linguist_source_file_globber_general.rb | # frozen_string_literal: true
require_relative 'test_linguist_source_file_globber'
# Test the LinguistSourceFileGlobber class
class TestLinguistSourceFileGlobberGeneral < TestLinguistSourceFileGlobber
def test_source_and_doc_files
globber = get_test_object { mock_files_found }
assert_equal(['a.rb', 'foo/b.m... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_task.rb | test/unit/test_task.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require_relative 'test_helper'
require_relative 'base_test_task'
# Unit test the Task class
class TestTask < BaseTestTask
def test_quality_task_some_suppressed
get_test_object(->(task) { task.skip_tools = ['flog'] }) do
setup_quality_task_mocks(suppressed_... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_task_ratchet.rb | test/unit/test_task_ratchet.rb | # frozen_string_literal: true
require_relative 'test_helper'
require_relative 'base_test_task'
# Test the process of finding fewer problems and tweaking down the
# numbers
class TestTaskRatchet < BaseTestTask
def test_ratchet_task
get_test_object { setup_ratchet_task_mocks }
end
def setup_ratchet_task_mock... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/base_test_task.rb | test/unit/base_test_task.rb | # frozen_string_literal: true
require 'quality/directory_of_classes'
# Tests that run individual tools as part of the test
class BaseTestTask < MiniTest::Test
current_dir = File.dirname(File.expand_path(__FILE__))
tool_classes = DirectoryOfClasses.new(dir: "#{current_dir}/tools",
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_command_output_processor.rb | test/unit/test_command_output_processor.rb | # frozen_string_literal: true
require_relative 'test_helper'
# Test the CommandOutputProcessor class
class TestCommandOutputProcessor < MiniTest::Test
def test_process_vanilla
@processor = get_test_object
@processor.file = vanilla_file
@processor.process do
0
end
end
def vanilla_file
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_version.rb | test/unit/test_version.rb | # frozen_string_literal: true
require_relative 'test_helper'
# Unit test the Version class
class TestVersion < MiniTest::Test
def test_version_specified
refute_nil(Quality::VERSION)
end
end
| ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/test_linguist_source_file_globber.rb | test/unit/test_linguist_source_file_globber.rb | # frozen_string_literal: true
require_relative 'test_helper'
# Test the LinguistSourceFileGlobber class
class TestLinguistSourceFileGlobber < MiniTest::Test
let_mock :target, :blob_a_rb, :blob_b_md, :blob_c, :blob_d_jsx, :blob_e_cfg
def expect_breakdown_pulled
@mocks[:project]
.expects(:breakdown_by_fi... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/rubocop.rb | test/unit/tools/rubocop.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'rubocop' tool within the quality gem
module Rubocop
def expect_rubocop_run(quality_checker)
@mocks[:quality_checker_class]
.expects(:new).with('rubocop',
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/pycodestyle.rb | test/unit/tools/pycodestyle.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module Pycodestyle
def pycodestyle_expected_args
'fake1.py'
end
def expect_pycodestyle_run(quality_checker)
@mocks[:quality_checker_... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/jscs.rb | test/unit/tools/jscs.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module Jscs
def jscs_expected_args
'-r unix fake1.js features/featuresfake1.js src/foo/testfake1.js'
end
def expect_jscs_run(quality_checker)
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/reek.rb | test/unit/tools/reek.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'reek' tool within the quality gem
module Reek
def expect_reek_run(quality_checker)
@mocks[:quality_checker_class]
.expects(:new).with('reek',
{ args: ree... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/punchlist.rb | test/unit/tools/punchlist.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module Punchlist
def punchlist_expected_args
"--glob '" + expected_source_and_doc_files_glob +
"' --regexp 'a|b'" \
" --exclude-glob '{... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/eslint.rb | test/unit/tools/eslint.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module Eslint
def eslint_expected_args
'-f unix fake1.js features/featuresfake1.js src/foo/testfake1.js'
end
def eslint_quality_checker_args
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/flake8.rb | test/unit/tools/flake8.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module Flake8
def flake8_expected_args
'fake1.py'
end
def expect_flake8_run(quality_checker)
@mocks[:quality_checker_class]
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/mdl.rb | test/unit/tools/mdl.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'mdl' tool within the quality gem
module Mdl
def mdl_expected_args
'file1.md file2.md'
end
def mdl_quality_checker_args
[
'mdl',
{
ar... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/rails_best_practices.rb | test/unit/tools/rails_best_practices.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module RailsBestPractices
def expect_rails_best_practices_run(quality_checker)
@mocks[:quality_checker_class]
.expects(:new).with('rails_best_pract... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/cane.rb | test/unit/tools/cane.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'cane' tool within the quality gem
module Cane
def cane_expected_args
"-f '#{expected_ruby_source_glob}' " \
"--abc-exclude '{**/vendor/**,db/schema.rb}' " \
"--style-exclude... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/bigfiles.rb | test/unit/tools/bigfiles.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module Bigfiles
def expected_source_files_glob
'{fake1.py,README.md}'
end
def bigfiles_expected_args
"--glob '" + expected_source_fi... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/flay.rb | test/unit/tools/flay.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'flay' tool within the quality gem
module Flay
def expect_flay_run(quality_checker)
@mocks[:quality_checker_class]
.expects(:new).with('flay',
{ args: fla... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/brakeman.rb | test/unit/tools/brakeman.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bigfiles' tool within the quality gem
module Brakeman
def brakeman_expected_args
'-q --summary -f csv 2>/dev/null'
end
def expect_brakeman_run(quality_checker)
@mocks[:qu... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/flog.rb | test/unit/tools/flog.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'flog' tool within the quality gem
module Flog
def expect_flog_run(quality_checker)
@mocks[:quality_checker_class]
.expects(:new).with('flog',
{ args: flo... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/bundle_audit.rb | test/unit/tools/bundle_audit.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'bundler_audit' tool within the quality gem
module BundleAudit
def expect_bundle_audit_run(quality_checker)
@mocks[:quality_checker_class]
.expects(:new).with('bundle-audit',
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/shellcheck.rb | test/unit/tools/shellcheck.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'shellcheck' tool within the quality gem
module Shellcheck
def shellcheck_expected_args
'-fgcc -sbash fake1.sh'
end
def expect_shellcheck_run(quality_checker)
@mocks[:qual... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tools/scalastyle.rb | test/unit/tools/scalastyle.rb | # frozen_string_literal: true
module Test
module Quality
module Tools
# Test for the 'scalastyle' tool within the quality gem
module Scalastyle
def scalastyle_expected_args
" -c 'project/scalastyle_config.xml' " \
"-x 'src/test/scala' " \
"s1.scala s2.scala"... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tool_tests/test_jscs.rb | test/unit/tool_tests/test_jscs.rb | # frozen_string_literal: true
require_relative '../test_helper'
# Test the JSCS module
class TestJscs < MiniTest::Test
def test_jscs_unconfigured
lines = ['No configuration found']
m = MockRunner.new(lines)
assert_equal(0, m.run('jscs'))
end
end
| ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tool_tests/test_flake8.rb | test/unit/tool_tests/test_flake8.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require_relative '../test_helper'
require_relative 'mock_runner'
require 'quality/tools/flake8'
# Unit test the Task class
class TestFlake8 < MiniTest::Test
def test_flake8
lines = [
'Usage: something something something',
'flake8: something somethi... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tool_tests/test_pep8.rb | test/unit/tool_tests/test_pep8.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
require_relative '../test_helper'
require_relative 'mock_runner'
require 'quality/tools/pycodestyle'
# Unit test the Pycodestyle class
class TestPycodestyle < MiniTest::Test
def test_pycodestyle
lines = [
'Usage: something something something',
'pyc... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/test/unit/tool_tests/mock_runner.rb | test/unit/tool_tests/mock_runner.rb | # frozen_string_literal: true
# Acts as the 'Runner' class for testing the tool plug-in modules
class MockRunner
def initialize(lines)
@lines = lines
end
attr_accessor :sum, :lines
def python_files
[]
end
def js_files
[]
end
def ratchet_quality_cmd(_name,
_opti... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/.git-hooks/pre_commit/circle_ci.rb | .git-hooks/pre_commit/circle_ci.rb | # frozen_string_literal: true
module Overcommit
module Hook
module PreCommit
# CircleCI plugin for Overcommit to validate config file (.circleci/config.yml)
class CircleCi < Base
def run
result = execute(command)
return :pass if result.success?
if result.success... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/feature/feature_helper.rb | feature/feature_helper.rb | # frozen_string_literal: true
require 'open3'
require 'quality'
# Add the bin directory, to allow testing of gem executables as if the gem is
# already installed.
root_dir = RSpec::Core::RubyProject.root
exec_dir = File.join(File::SEPARATOR, root_dir, 'bin')
ENV['PATH'] = [exec_dir, ENV.fetch('PATH')].join(File::PATH... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/feature/quality/quality_checker_spec.rb | feature/quality/quality_checker_spec.rb | # frozen_string_literal: true
require_relative '../feature_helper'
require 'quality/quality_checker'
describe Quality::QualityChecker do
it 'has an example feature spec' do
expect(exec_io('echo test')).to eq("test\n")
end
end
| ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'simplecov'
require 'simplecov-lcov'
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
[
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter,
]
)
SimpleCov.s... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/spec/quality/ruby_spawn_spec.rb | spec/quality/ruby_spawn_spec.rb | # frozen_string_literal: true
require 'quality/ruby_spawn'
describe Quality::RubySpawn do
let(:ruby_spawn) do
described_class.new(cmd, args)
end
describe '#invocation' do
context 'with args' do
subject { ruby_spawn.invocation }
let(:cmd) { 'cmd' }
let(:args) { 'arg1 arg2' }
it... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/spec/quality/config_spec.rb | spec/quality/config_spec.rb | # frozen_string_literal: true
require 'quality/config'
describe Quality::Config do
let(:globber) { instance_double(Quality::LinguistSourceFileGlobber) }
let(:dir) { class_double(Dir) }
let(:config) do
described_class.new(source_file_globber: globber, dir: dir)
end
describe '#minimum_threshold' do
c... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/spec/quality/tools/bigfiles_spec.rb | spec/quality/tools/bigfiles_spec.rb | # frozen_string_literal: true
require_relative '../../spec_helper'
require 'quality/tools/bigfiles'
require 'quality/runner'
describe Quality::Tools::Bigfiles do
let(:runner) { instance_double(Quality::Runner) }
let(:bigfiles) { described_class.new(runner) }
it 'can be created' do
expect(bigfiles).not_to b... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality.rb | lib/quality.rb | # frozen_string_literal: true
require 'quality/version'
| ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/command_output_processor.rb | lib/quality/command_output_processor.rb | # frozen_string_literal: true
module Quality
# Class processes output from a code quality command, tweaking it
# for editor output and counting the number of violations found
class CommandOutputProcessor
attr_accessor :emacs_format, :file
attr_reader :found_output, :violations
def initialize
@... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/directory_of_classes.rb | lib/quality/directory_of_classes.rb | # frozen_string_literal: true
# this 'time' require statement is needed as of active_support, which
# tries to remap the xmlschema method. Turns out there are two 'Time'
# classes - methods get added when you "require 'time'".
#
# https://github.com/rails/rails/pull/40859
#
# https://app.circleci.com/pipelines/github... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/version.rb | lib/quality/version.rb | # frozen_string_literal: true
# Quality is a tool that runs quality checks on Ruby code using cane,
# reek, flog, flay and rubocop and makes sure your numbers don't get
# any worse over time.
# :nocov:
module Quality
VERSION = '40.0.1'
end
# :nocov:
| ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/ruby_spawn.rb | lib/quality/ruby_spawn.rb | # frozen_string_literal: true
module Quality
# Spawn a ruby process
class RubySpawn
def initialize(cmd, args)
@cmd = cmd
@args = args
end
def invocation
if @args.empty?
cmd_with_ruby_hack_prefix.to_s
else
"#{cmd_with_ruby_hack_prefix} #{@args}"
end
end... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/which.rb | lib/quality/which.rb | # frozen_string_literal: true
# http://stackoverflow.com/questions/2108727/
# which-in-ruby-checking-if-program-exists-in-path-from-ruby
module Quality
# Determine where a given executable lives, like the UNIX 'which' command
class Which
def initialize(env: ENV,
file: File,
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/runner.rb | lib/quality/runner.rb | # frozen_string_literal: true
require 'active_support/inflector'
require 'forwardable'
require_relative 'which'
require_relative 'directory_of_classes'
require_relative 'tool'
# Quality is a tool that runs quality checks on Ruby code using cane,
# reek, flog, flay and rubocop and makes sure your numbers don't get
# a... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/process.rb | lib/quality/process.rb | # frozen_string_literal: true
require 'English'
module Quality
# Wrapper around IO.popen that allows exit status to be mocked in tests.
class Process
def initialize(full_cmd,
dependencies = {})
@full_cmd = full_cmd
@popener = dependencies[:popener] || IO
end
def run(&bl... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/quality_checker.rb | lib/quality/quality_checker.rb | # frozen_string_literal: true
require_relative 'command_output_processor'
require_relative 'process'
require_relative 'ruby_spawn'
require 'high_water_mark/threshold'
module Quality
# Runs a quality-checking, command, checks it agaist the existing
# number of violations for that command, and decreases that number... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/config.rb | lib/quality/config.rb | # frozen_string_literal: true
# XXX: I should figure out how to use tagged releases in github. Example:
# https://github.com/xsc/lein-ancient/issues/29
# https://github.com/xsc/lein-ancient/releases
require 'forwardable'
require_relative 'linguist_source_file_globber'
module Quality
# Configuration for running q... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/linguist_source_file_globber.rb | lib/quality/linguist_source_file_globber.rb | # frozen_string_literal: true
require 'rugged'
require 'linguist'
module Quality
# Uses the Linguist gem to find and classify source files.
#
# Note: Requires files to be commited within a git repo.
class LinguistSourceFileGlobber
def initialize(repo: Rugged::Repository.new('.'),
commit... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tool.rb | lib/quality/tool.rb | # frozen_string_literal: true
module Quality
module Tools
# represents a code quality tool which can be run on source files
class Tool
extend ::Forwardable
def initialize(runner)
@runner = runner
end
def_delegators(:@runner,
:source_and_doc_files_glob,
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/rubocop.rb | lib/quality/tools/rubocop.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'rubocop' tool support to quality gem
class Rubocop < Tool
def rubocop_args
[
'--force-exclusion',
'--require rubocop-minitest',
'--require rubocop-rake',
'--require rubocop-rspec',
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/pycodestyle.rb | lib/quality/tools/pycodestyle.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'pycodestyle' tool support to quality gem
class Pycodestyle < Tool
def pycodestyle_args
python_files.join(' ')
end
def pycodestyle_count_errors(line)
if line =~ /^Usage:/
# no files specified
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/jscs.rb | lib/quality/tools/jscs.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'bigfiles' tool support to quality gem
class Jscs < Tool
def jscs_args
'-r unix ' + js_files.join(' ')
end
def jscs_check_configured
return 0 if js_files.empty?
puts 'No JSCS config found! To generat... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/reek.rb | lib/quality/tools/reek.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'reek' tool support to quality gem
class Reek < Tool
def quality_reek
args = "--single-line #{ruby_files.join(' ')}"
ratchet_quality_cmd('reek',
args: args,
emacs_for... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/punchlist.rb | lib/quality/tools/punchlist.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'punchlist' tool support to quality gem
class Punchlist < Tool
def punchlist_args
glob = "--glob '#{source_and_doc_files_glob}'"
regexp = " --regexp '#{punchlist_regexp}'" if punchlist_regexp
exclude = " --exclude-... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/eslint.rb | lib/quality/tools/eslint.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'bigfiles' tool support to quality gem
class Eslint < Tool
def eslint_args
'-f unix ' + js_files.join(' ')
end
def quality_eslint
ratchet_quality_cmd('eslint',
args: eslint_args,
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/flake8.rb | lib/quality/tools/flake8.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'flake8' tool support to quality gem
class Flake8 < Tool
def flake8_args
python_files.join(' ')
end
def flake8_count_errors(line)
if line =~ /^Usage:/
# no files specified
0
elsif l... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/mdl.rb | lib/quality/tools/mdl.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'bigfiles' tool support to quality gem
class Mdl < Tool
def mdl_args
markdown_files.join(' ')
end
def quality_mdl
if mdl_args.empty?
puts 'No markdown files found--skipping mdl'
return
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/rails_best_practices.rb | lib/quality/tools/rails_best_practices.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'rubocop' tool support to quality gem
class RailsBestPractices < Tool
def quality_rails_best_practices
ratchet_quality_cmd('rails_best_practices',
gives_error_code_on_violations: true) do |line|
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/cane.rb | lib/quality/tools/cane.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'cane' tool support to quality gem
class Cane < Tool
def cane_exclude_args
[
"--abc-exclude '#{source_files_exclude_glob}'",
"--style-exclude '#{source_files_exclude_glob}'",
"--doc-exclude '#{source_... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/bigfiles.rb | lib/quality/tools/bigfiles.rb | # frozen_string_literal: true
require_relative '../tool'
module Quality
module Tools
# Adds 'bigfiles' tool support to quality gem
class Bigfiles < Tool
def bigfiles_args
args = ['--glob', "'#{source_and_doc_files_glob}'"]
args << ['--exclude-glob', "'#{source_files_exclude_glob}'"] un... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/flay.rb | lib/quality/tools/flay.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'flay' tool support to quality gem
class Flay < Tool
def flay_args
"--mass 75 --timeout 99999 #{ruby_files.join(' ')}"
end
def quality_flay
ratchet_quality_cmd('flay',
args: flay_ar... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/brakeman.rb | lib/quality/tools/brakeman.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'rubocop' tool support to quality gem
class Brakeman < Tool
def quality_brakeman
ratchet_quality_cmd('brakeman',
args: '-q --summary -f csv 2>/dev/null',
gives_error_code_on_... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/flog.rb | lib/quality/tools/flog.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'flog' tool support to quality gem
class Flog < Tool
def quality_flog
args = "--all --continue --methods-only #{ruby_files.join(' ')}"
ratchet_quality_cmd('flog', args: args, emacs_format: true) do |line|
self.cl... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
apiology/quality | https://github.com/apiology/quality/blob/1e9d8d1394b9c9cf49548aa5055f48c270913a5b/lib/quality/tools/bundle_audit.rb | lib/quality/tools/bundle_audit.rb | # frozen_string_literal: true
module Quality
module Tools
# Adds 'bundler_audit' tool support to quality gem
class BundleAudit < Tool
def self.command_name
'bundle-audit'
end
def quality_bundle_audit
ratchet_quality_cmd('bundle-audit',
args: '',
... | ruby | MIT | 1e9d8d1394b9c9cf49548aa5055f48c270913a5b | 2026-01-04T17:33:09.703687Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.