hexsha stringlengths 40 40 | size int64 2 1.01M | content stringlengths 2 1.01M | avg_line_length float64 1.5 100 | max_line_length int64 2 1k | alphanum_fraction float64 0.25 1 |
|---|---|---|---|---|---|
081d5a2e457a62588919bbf978f2a18c0ae730c0 | 344 | module Tiki
module Torch
class JsonTranscoder < Transcoder
class << self
def codes
Torch::Config::JSON_CODES
end
def encode(body = {})
MultiJson.dump body
end
def decode(str)
MultiJson.load(str, symbolize_keys: true)
end
... | 14.956522 | 51 | 0.537791 |
6ab7be2f7974a9d26b6f5d317372c94ac3a09ad2 | 540 | # Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path
# Precompile additional ... | 45 | 93 | 0.768519 |
187126949e9bd73c47f514125c017c89c3ab4336 | 240 | # frozen_string_literal: true
require_relative "../../support/test_classes/example_redis_hash"
RSpec.describe ExampleRedisHash, type: :integration do
subject { described_class }
it { is_expected.to inherit_from RedisHash::Base }
end
| 24 | 64 | 0.7875 |
4a7ed5263609f8b050260b1353384cd99d79d314 | 358 | class Parrot < ActiveRecord::Base
set_inheritance_column :parrot_sti_class
has_and_belongs_to_many :pirates
has_and_belongs_to_many :treasures
has_many :loots, :as => :looter
alias_attribute :title, :name
validates_presence_of :name
end
class LiveParrot < Parrot
end
class DeadParrot < Parrot
belongs_to... | 21.058824 | 45 | 0.782123 |
e83a7e7b12ce02d199af185817509aae42659b05 | 1,180 | require 'spec_helper'
describe 'git' do
context 'supported operating systems' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
context "git class without any parameters" do
it { is_expected.to compile.with_all_deps }
... | 30.25641 | 116 | 0.614407 |
d5650d3e546a22a7707fb74ae0d007ea2e8e67e7 | 187 | class AddCreatedDateToFollow < ActiveRecord::Migration
def change
add_column :follows, :created_datetime, :datetime, null: false
add_index :follows, :created_datetime
end
end
| 26.714286 | 66 | 0.775401 |
5dfb8b810cb128da3624bf119b269da2e3d2f9ce | 1,372 | require "test_helper"
class EmailSignupPagesFinderTest < ActiveSupport::TestCase
test 'EmailSignupPagesFinder.find returns a data structure representing the email signup pages for the MHRA' do
signup_page = EmailSignupPagesFinder.find(mhra)
assert_equal signup_page.map { |p| p[:text] },
[
... | 37.081081 | 113 | 0.739796 |
7ab103298ae5f2d4ea71263dd951eac1c2138ec8 | 387 | Rails.application.routes.draw do
get 'users/new'
get 'static_pages/home'
get '/help', to: 'static_pages#help'
get '/about', to: 'static_pages#about'
get '/contact', to: 'static_pages#contact'
get '/signup', to: 'users#new'
resources :users
root 'static_pages#home'
# For details on the DSL available wi... | 32.25 | 101 | 0.713178 |
11281b8b65690ff0b5c2efbbee5fff08e359d574 | 813 | class PostReceive
@queue = :post_receive
def self.perform(repo_path, oldrev, newrev, ref, identifier)
repo_path.gsub!(Gitlab.config.git_base_path.to_s, "")
repo_path.gsub!(/.git$/, "")
repo_path.gsub!(/^\//, "")
project = Project.find_with_namespace(repo_path)
return false if project.nil?
... | 31.269231 | 84 | 0.677737 |
e81b43e7800562f8e935cb37e302a36e22d2d0ac | 364 | require 'attachment_fields/version'
require 'attachment_fields/engine'
require 'attachment_fields/fields/attachment'
require 'attachment_fields/fields/direct_attachment'
require 'attachment_fields/fields/multiple_attachment'
require 'attachment_fields/fields/presigned_attachment'
module Administrate
module Refile
... | 26 | 55 | 0.846154 |
39cfdf027bd11af3e13b898f73ebab8cdaf644a4 | 1,554 | unless ENV['CI']
begin
require 'simplecov'
SimpleCov.start do
add_filter 'test'
end
rescue LoadError
end
end
require 'minitest/unit'
if ENV['LEFTRIGHT']
begin
require 'leftright'
rescue LoadError
puts "Run `gem install leftright` to install leftright."
end
end
require File.expan... | 17.460674 | 72 | 0.6287 |
2694d9e41647b5aac4308748431f6c1c88426228 | 1,822 | #-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork ... | 38.765957 | 95 | 0.649286 |
f76c48198281f84d48f08601f00d5f2bc403bfab | 3,148 | class ArtistUrl < ApplicationRecord
before_save :initialize_normalized_url, on: [ :create ]
before_save :normalize
validates_presence_of :url
validate :validate_url_format
belongs_to :artist, :touch => true
def self.normalize(url)
if url.nil?
nil
else
url = url.gsub(/^https:\/\//, "http... | 31.48 | 101 | 0.587357 |
b9d77674afa33ca9edcf17cea74be16f14f88421 | 1,970 | class Grep < Formula
desc "GNU grep, egrep and fgrep"
homepage "https://www.gnu.org/software/grep/"
url "https://ftp.gnu.org/gnu/grep/grep-3.3.tar.xz"
mirror "https://ftpmirror.gnu.org/grep/grep-3.3.tar.xz"
sha256 "b960541c499619efd6afe1fa795402e4733c8e11ebf9fafccc0bb4bccdc5b514"
bottle do
cellar :any
... | 31.269841 | 93 | 0.691878 |
394cb540e96f3771e73bcde6b972c00e5d05b8db | 377 | cask 'font-noto-sans-coptic' do
version :latest
sha256 :no_check
# noto-website.storage.googleapis.com was verified as official when first introduced to the cask
url 'https://noto-website.storage.googleapis.com/pkgs/NotoSansCoptic-unhinted.zip'
name 'Noto Sans Coptic'
homepage 'https://www.google.com/get/n... | 31.416667 | 98 | 0.763926 |
6198394b2b29d2104a0545066fb3bdd393ab774c | 716 | module Roadworker
class Utils
module Helper
def matched_zone?(name)
result = true
if @options.exclude_zone
result &&= name !~ @options.exclude_zone
end
if @options.target_zone
result &&= name =~ @options.target_zone
end
result
end
... | 21.058824 | 77 | 0.52514 |
bf470a360794ae2959dd05e99c832b32c1e216dc | 1,322 | require 'test_helper'
class SettingsControllerTest < ActionDispatch::IntegrationTest
setup do
@setting = settings(:one)
end
test "should get index" do
get settings_url
assert_response :success
end
test "should get new" do
get new_setting_url
assert_response :success
end
test "shoul... | 26.979592 | 210 | 0.741301 |
bf6cba32235a29f377146ce994b3b519b1eb169d | 711 | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module RailsSampleApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated ... | 30.913043 | 79 | 0.739803 |
7add8cc43122b32b94698ccd5be0550c4872672c | 609 | Rails.application.routes.draw do
# devise_for :users, :skip => [:registrations] , controllers: {
# sessions: 'users/sessions'
# }
# as :user do
# get 'users/edit' => 'devise/registrations#edit', :as => 'edit_user_registration'
# put 'users' => 'devise/registrations#update', :as => 'user_registration'
... | 29 | 86 | 0.64532 |
aba8c2bef912211c398ff77008ab8590cb4117eb | 453 | module SphinxRakeSupport
class Schedule
def self.ts_start
call_rake('ts:start')
end
def self.ts_index
call_rake('ts:index')
end
def self.call_rake(task, options = {})
options[:rails_env] ||= Rails.env
args = options.map { |n, v| "#{n.to_s.upcase}='#{v}'" }
system ... | 20.590909 | 125 | 0.582781 |
f7c1e75cc8bac997b4fd0c22990d3a18bafb1666 | 2,146 | require File.dirname(__FILE__) + '/spec_helper'
require File.dirname(__FILE__) / '..' / "lib" / "merb_mail_queue"
Merb::MailQueue.load_plugin!
describe Merb::MailQueue do
before :all do
@adapter_path = File.dirname(__FILE__) / ".." / "lib" / "merb_mail_queue" / "adapters"
@ar_path = @adapter_path / "act... | 30.225352 | 90 | 0.697577 |
33e905ccc969cde398ed3243b617f1a72a75b1c9 | 3,130 | module VKRB
class Authorizer
REDIRECT_URI = 'blank.html'
DISPLAY_TYPE = 'page'
RESPONSE_TYPE = 'token'
attr_accessor :app_id, :user, :pass, :scope
def initialize(app_id:, user:, pass:, scope:)
self.app_id = app_id
self.user = user
self.pass = pass
self.scope = scop... | 33.655914 | 130 | 0.493291 |
61562c8d85151ee11e6d76201430adb4811877fa | 2,949 | RSpec.describe("Insights::API::Common::Filter", :type => :request) do
let(:external_tenant) { rand(1000).to_s }
let(:tenant) { Tenant.create!(:name => "default", :external_tenant => external_tenant) }
let(:source_type) { SourceType.create(:name => "rhev", :product_name => "RedHat Virtualization", :ve... | 44.014925 | 170 | 0.645303 |
21ee4177fd70d4be999f1070c529b355ed486bdd | 1,336 | # frozen_string_literal: true
class ManifestBuilder
class StructureBuilderV3 < IIIFManifest::V3::ManifestBuilder::StructureBuilder
def range_builder(top_range)
RangeBuilder.new(
top_range,
record, true,
canvas_builder_factory: canvas_builder_factory,
iiif_range_factory: iiif_... | 29.043478 | 94 | 0.607036 |
abf1bb5a2576660495213bee99197bc206507821 | 7,912 | module Pod
class Installer
class Xcode
class PodsProjectGenerator
# Creates the targets which aggregate the Pods libraries in the Pods
# project and the relative support files.
#
class AggregateTargetInstaller < TargetInstaller
# Creates the target in the Pods proje... | 43.472527 | 110 | 0.583038 |
d5d28eaf78634d187ba527de8bc41bec6af2b6ab | 4,858 | # frozen_string_literal: true
# WARNING ABOUT GENERATED CODE
#
# This file is generated. See the contributing guide for more information:
# https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md
#
# WARNING ABOUT GENERATED CODE
module Aws::STS
# When STS returns an error response, the Ruby SDK construc... | 29.08982 | 100 | 0.660148 |
e94621afbc4b7d930127ebf176921253188a380b | 1,520 | class TerraformLs < Formula
desc "Terraform Language Server"
homepage "https://github.com/hashicorp/terraform-ls"
url "https://github.com/hashicorp/terraform-ls/archive/v0.16.0.tar.gz"
sha256 "7adf20abb78363e07bb9d4ae3ff608770e857e2372f2122b2ae5637101d48040"
license "MPL-2.0"
head "https://github.com/hashic... | 31.020408 | 122 | 0.711842 |
335304f726f03a480221df488ca4cdade9d7ae28 | 1,656 | # frozen_string_literal: true
RSpec.describe ZadarmaApi::Client do
subject(:client_class) { described_class }
let(:key) { ENV.fetch('API_TEST_KEY', 'api_test_key') }
let(:secret) { ENV.fetch('API_TEST_SECRET', 'api_test_secret') }
let(:client) { subject.new(key: key, secret: secret) }
it 'client simple co... | 28.067797 | 117 | 0.637681 |
f762f00ffa4fa25bfaa9ec4b5f87600fd6a1d0a5 | 979 | module Notsofast
class Config
@whitelist = []
@blacklist = []
@request_limit = 100
@response_types = ["text/html"]
@limit_expiry = 60
@notify = Proc.new{|ip, env| }
def self.configure(&block)
yield self
end
def self.whitelist=(value)
@whitelist = value
end
d... | 15.296875 | 35 | 0.597549 |
189c0487dfb3307132f8cae61e824c728b463b9e | 249 | desc 'Refresh the token value with the Instagram API'
task refresh: :environment do
InstagramTokenAgent::Store.accounts.each do |account|
client = InstagramTokenAgent::Client.new(account, app.settings)
client.refresh
sleep 1
end
end
| 27.666667 | 67 | 0.759036 |
4a926ba68ce078bebd0ee0b14b09e3756feacdad | 93 | # Module to keep the current library version.
module GoogleAdsSavon
VERSION = "1.0.3"
end
| 15.5 | 45 | 0.741935 |
2184e00234e645671743dea27fb4af97b9c60401 | 1,745 | # frozen_string_literal: true
require 'spec_helper'
describe Noicycle do
it 'returns a hash with as many results as requested when the reference date is old enough' do
noicycle = Noicycle::Noicycle.new
ref_date = Date.parse('5th May 2013')
(3..5).each do |i|
tapes = noicycle.tapes(ref_date, i)
... | 37.12766 | 96 | 0.683095 |
7a3a3f16b72ebe982b6c68e315aef74ebb0d6826 | 1,382 | # This helper task is needed to reset the camunda engine on heroku because we can't restart the engine
namespace :camunda do
desc "delete camunda docker container"
task reset: :environment do
Camunda::User.all.reject { |user| ["demo", "john", "mary", "peter"].include?(user.id) }.each do |user|
user.destro... | 30.711111 | 131 | 0.704052 |
1d52f55596c33d522bfc037c3e619b7da61aae23 | 2,208 | cask 'wireshark-chmodbpf' do
version '3.0.1'
sha256 '78bd0568251d95f42f3ea60cfc4d2e8e14bb76745c10cafec418f5fa0943cf64'
url "https://www.wireshark.org/download/osx/Wireshark%20#{version}%20Intel%2064.dmg"
appcast 'https://www.wireshark.org/download/osx/'
name 'Wireshark-ChmodBPF'
homepage 'https://www.wires... | 36.196721 | 86 | 0.571105 |
873b9962eaa1c786a32117a9183769f67324d42d | 67 | RSpec.describe IDONTEXISTZ do
it { expect(true).to be true }
end
| 16.75 | 32 | 0.731343 |
874de95c35da4573f83318ed7f93da2acac0c8e4 | 1,340 | # -*- coding: utf-8 -*- #
# frozen_string_literal: true
describe Rouge::Lexers::PLSQL do
let(:subject) { Rouge::Lexers::PLSQL.new }
describe 'guessing' do
include Support::Guessing
it 'guesses by filename' do
assert_guess :filename => 'foo.pls'
assert_guess :filename => 'foo.typ'
assert... | 26.8 | 55 | 0.583582 |
1cc9c465ac47b7bdae58d24fa67bf12c9cccad43 | 6,699 | # encoding: UTF-8
# frozen_string_literal: true
module Jekyll
module Drops
class Drop < Liquid::Drop
include Enumerable
NON_CONTENT_METHODS = [:fallback_data, :collapse_document].freeze
# Get or set whether the drop class is mutable.
# Mutability determines whether or not pre-defined fi... | 31.013889 | 88 | 0.587103 |
61bd2ecd0427422f407f4f75ecb534aeca99ee30 | 165 | class CreateCinemaHalls < ActiveRecord::Migration[5.1]
def change
create_table :cinema_halls do |t|
t.string :name
t.timestamps
end
end
end
| 16.5 | 54 | 0.678788 |
01de4e1fef9e31f864b4aca3e7e2a8bbbac4e813 | 3,654 | require 'csv'
namespace :reports do
namespace :shop do
desc "Report of Initial/Renewal/Conversion ERs that Failed Minimum Participation or Non-Owner Rule"
task :employers_failing_minimum_participation => :environment do
include Config::AcaHelper
window_date = Date.today
valid_states = (Ben... | 52.2 | 154 | 0.574165 |
bbcbcb2339e16444c2520bafd1ebadbf2f4f0cfa | 10,131 | require 'test/unit'
class TestVarArgBlock < Test::Unit::TestCase
def blockyield(arg)
yield arg
end
def blockarg(arg, &b)
b.call(arg)
end
def test_vararg_blocks
Proc.new { |*element| assert_equal [["a"]], element }.call( ["a"] )
Proc.new { |*element| assert_equal ["a"], element }.call( "... | 47.12093 | 77 | 0.599546 |
11763b4e88b704e724d9ab281a33fadf5e43a7ca | 4,781 | # frozen_string_literal: true
module Bundler
class BundlerError < StandardError
def self.status_code(code)
define_method(:status_code) { code }
if match = BundlerError.all_errors.find {|_k, v| v == code }
error, _ = match
raise ArgumentError,
"Trying to register #{self} for ... | 29.88125 | 106 | 0.697134 |
4af2c2ab3300419f072c062faad99b7f9e704d51 | 1,884 | # Copyright 2010 Wincent Colaiuta. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the ... | 40.085106 | 79 | 0.730361 |
08ecbf899c1c77ff78fa7e4c6fdedb1cf6d1581b | 15,884 | require "openid/consumer/idres.rb"
require "openid/consumer/checkid_request.rb"
require "openid/consumer/associationmanager.rb"
require "openid/consumer/responses.rb"
require "openid/consumer/discovery_manager"
require "openid/consumer/discovery"
require "openid/message"
require "openid/yadis/discovery"
require "openid... | 40.111111 | 77 | 0.711156 |
1d9a0ad532ead48bea90615fe2fcecb6b6393ea5 | 347 | class AddReceptacleSampleIsCurrentIndexToAliquots < ActiveRecord::Migration
def self.up
add_index :aliquots, [ :receptacle_uuid, :sample_uuid, :is_current ], :name => 'receptacle_uuid_and_sample_uuid_and_is_current_idx'
end
def self.down
drop_index :aliquots, :name => 'receptacle_uuid_and_sample_uuid_and... | 34.7 | 135 | 0.798271 |
4af18f7a76141bc662ca032c6815aa1008091402 | 6,486 | =begin
#Accounting API
#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Contact: api@xero.com
Generated by: https://openapi-generator.tech
OpenAPI Generator version: 4.3.1
=end
require 'time'
require 'date'
module XeroRuby::Accounting
require 'bigdecimal... | 30.308411 | 208 | 0.625039 |
28f30881f88cae4aa15121432fb60ea0994d0869 | 969 | Pod::Spec.new do |s|
s.name = 'XS2AiOS'
s.version = '1.6.2'
s.summary = 'Native integration of FinTecSystems XS2A API for your iOS apps.'
s.homepage = 'https://github.com/FinTecSystems/xs2a-ios'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author ... | 35.888889 | 106 | 0.608875 |
d5f00df357c65fb4b5ce9034a9517f2542128c38 | 146 | # frozen_string_literal: true
class RemoveSnFromWithdraw < ActiveRecord::Migration[4.2]
def change
remove_column :withdraws, :sn
end
end
| 18.25 | 57 | 0.767123 |
ed584dde97699b4e8aaf228019f580e971612cef | 1,460 | =begin
#Selling Partner API for Orders
#The Selling Partner API for Orders helps you programmatically retrieve order information. These APIs let you develop fast, flexible, custom applications in areas like order synchronization, order research, and demand-based decision support tools.
OpenAPI spec version: v0
Gener... | 30.416667 | 247 | 0.763014 |
1809b2df6f4526724794eba084114b1199fa6c5e | 579 | cask 'font-laila' do
version '2.000'
sha256 'caa87cae373702288a7510c74881077aa15e3b5c94a4746b61f3f977d8499f73'
url "https://github.com/itfoundry/laila/releases/download/v#{version}/laila-#{version.dots_to_underscores}.zip"
appcast 'https://github.com/itfoundry/laila/releases.atom',
checkpoint: 'a74ea... | 34.058824 | 113 | 0.766839 |
ff286ee3682207099afc4364918af469d31edf5a | 334 | require 'spec_helper'
describe "/articles/index.html.haml" do
include ArticlesHelper
before(:each) do
#article_98 = mock_model(Article)
#article_99 = mock_model(Article)
#assigns[:articles] = [article_98, article_99]
end
it "should render list of articles" do
#render "/articles/index.html.ham... | 19.647059 | 50 | 0.709581 |
bbb456a5cfa10c5e65e44d34353b9c2058115c9b | 644 | # frozen_string_literal: true
module Awspec::Generator
module Doc
module Type
class SnsTopic < Base
def initialize
super
@type_name = 'SnsTopic'
@type = Awspec::Type::SnsTopic.new('my-sns')
@ret = @type.resource_via_client
@matchers = %w[include_sub... | 30.666667 | 109 | 0.649068 |
269da800db69df93a592e64cd2b9f305c21202f5 | 7,263 | ##
# Hash(Ext) Test
assert('Hash.[] Hash') do
a = Hash['a_key' => 'a_value']
assert_equal({'a_key' => 'a_value'}, a)
end
assert('Hash.[] [ [ ["b_key", "b_value" ] ] ]') do
a = Hash[ [ ['b_key', 'b_value'] ] ]
assert_equal({'b_key' => 'b_value'}, a)
a = Hash[ [ ] ]
assert_equal({}, a)
assert_raise(A... | 24.129568 | 84 | 0.556382 |
089b9127f73ec7f6ece93b71989c45ff9c738020 | 135 | class CreateCountries < ActiveRecord::Migration
def change
create_table :countries do |t|
t.string :name
end
end
end
| 16.875 | 47 | 0.696296 |
4a56734dc7def73fd86eaebb91f28bafb1525698 | 5,364 | module Cofidin
class Comprobante
attr_accessor :version
attr_accessor :serie
attr_accessor :folio
attr_accessor :fecha
attr_accessor :sello
attr_accessor :forma_de_pago
attr_accessor :no_certificado
attr_accessor :certificado
attr_accessor :condiciones_de_pago
attr_accessor :su... | 36.489796 | 119 | 0.695936 |
2151d8649157200f61510e631f7871be2580f610 | 3,659 | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | 39.771739 | 102 | 0.753211 |
03dc19a1adf669d5cd8c5324887abc2553c2e553 | 520 | class AccountActivationsController < ApplicationController
def edit
user = User.find_by(email: params[:email])
if user && !user.activated? && user.authenticated?(:activation, params[:id])
user.activate
# user.update_attribute(:activated, true)
# user.update_attribute(:activated_at, Time... | 27.368421 | 80 | 0.675 |
28693ae8e8886c7d8c3e62ad63eb1d30d00911cc | 281 | class SesionController < ApplicationController
def new
end
def create
puts params[:correo]
#correo=Autenticacion.find_by_correo(params[:correo])
#puts correo
end
def destroy
session[:user_id] = nil
#redirect_to root_url, notice: "Logged out!"
end
end
| 17.5625 | 56 | 0.715302 |
f8b46c3e4a7965f72bebd5eeef68b3052d055267 | 330 | module Selenium
module WebDriver
module Safari
class Browser
def start(*args)
@process = ChildProcess.new(Safari.path, *args)
@process.io.inherit! if $DEBUG
@process.start
end
def stop
@process.stop if @process
end
end
end... | 16.5 | 57 | 0.548485 |
1c2cd71af29f9ce823bef398d8853ae1b633ee94 | 296 | require "active_support"
require "active_support/core_ext"
require "wannabe_bool"
require "http"
require "hashie"
require "ruboty"
require "ruboty/todoist/version"
require "ruboty/todoist/resorces"
require "ruboty/handlers/todoist"
require "ruboty/actions/item"
require "ruboty/actions/project"
| 22.769231 | 33 | 0.810811 |
1c4e220dc6d9174e6c4f1903250822d83456cf11 | 2,928 | # frozen_string_literal: true
RSpec.describe RuboCop::Cop::Lint::IneffectiveAccessModifier do
subject(:cop) { described_class.new }
context 'when `private` is applied to a class method' do
it 'registers an offense' do
expect_offense(<<~RUBY)
class C
private
def self.method
... | 24 | 158 | 0.560792 |
f71837484245ea0d5815a8769eafe7797d114e69 | 1,540 | class NanopbGenerator < Formula
desc "C library for encoding and decoding Protocol Buffer messages"
homepage "https://jpa.kapsi.fi/nanopb/docs/index.html"
url "https://jpa.kapsi.fi/nanopb/download/nanopb-0.3.9.tar.gz"
sha256 "f6fe05441150bf158c2adfec29fa8206785bbb6c3dcd4a3ddbafcf8f9ad9f251"
revision 1
bott... | 35.813953 | 93 | 0.692208 |
ab2c51a2c60e4edfd4f85b7cbb4d0dce0bc7e217 | 5,368 | # -*- encoding: utf-8 -*-
# stub: mime-types 3.1 ruby lib
Gem::Specification.new do |s|
s.name = "mime-types".freeze
s.version = "3.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib".freeze]
s.authors = ["Austin Ziegler"... | 63.152941 | 802 | 0.666356 |
1833c3201d5108ecfefd4348f4228f78ce2c0850 | 23,159 | require 'test_helper'
require 'json'
require 'pathname'
class JSONSchemerTest < Minitest::Test
def test_that_it_has_a_version_number
refute_nil ::JSONSchemer::VERSION
end
def test_it_does_something_useful
schema = {
'type' => 'object',
'maxProperties' => 4,
'minProperties' => 1,
... | 26.742494 | 130 | 0.490522 |
28c82deaa0b697bc773f998f5070f6bd82fb0cf2 | 880 | # frozen_string_literal: true
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
validates :name, presen... | 23.157895 | 71 | 0.686364 |
bbd6c4ebb32b1118c8082ce9ac37efd6363d2657 | 2,006 | begin
require 'vagrant'
rescue LoadError
raise "The Vagrant oVirt plugin must be run within Vagrant."
end
# This is a sanity check to make sure no one is attempting to install
# this into an early Vagrant version.
if Vagrant::VERSION < '1.1.0'
raise "The Vagrant oVirt plugin is only compatible with Vagrant 1.1+... | 26.746667 | 72 | 0.622632 |
18fea3457c881492f82ced2a24e6fc5d85b6471a | 1,588 | #
# Be sure to run `pod lib lint MyTestLib.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#
Pod::Spec.new do |s|
s.name = 'MyTestLib'... | 36.930233 | 107 | 0.639798 |
d5953fc395c41e48f742f038c726b54b0814f49c | 1,110 | cask 'unity-ios-support-for-editor@2017.4.22f1' do
version '2017.4.22f1,eb4bc6fa7f1d'
sha256 :no_check
url "https://download.unity3d.com/download_unity/eb4bc6fa7f1d/MacEditorTargetInstaller/UnitySetup-iOS-Support-for-Editor-2017.4.22f1.pkg"
name 'iOS Build Support'
homepage 'https://unity3d.com/unity/'
pk... | 30.833333 | 139 | 0.714414 |
91b4cfefcbe5b0c82a51a4201f2fc6bf1914f72d | 177 | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include SessionsHelper
def hello
render html: "hello, world!"
end
end
| 17.7 | 52 | 0.757062 |
5d0493e11354df7dfbd5266fa4850517757baac6 | 2,411 | # typed: true
class Upload < ApplicationRecord
include JsonExportable
include ContentTypes
attr_accessor :system_upload
belongs_to :user
belongs_to :uploadable, polymorphic: true
before_destroy :delete_file
validates :file_size, numericality: {
greater_than: 500.bytes,
less_than: 20.megabytes,... | 20.784483 | 111 | 0.692659 |
0855356cb4dece96a26c5594b73e5d2bfc93e8c9 | 233 | # frozen_string_literal: true
require 'spec_helper'
require 'depralyzer/version'
RSpec.describe Depralyzer do
describe Depralyzer::VERSION do
it 'exists' do
expect(Depralyzer::VERSION).not_to be_nil
end
end
end
| 15.533333 | 47 | 0.742489 |
f771846ea7193391b60e1ad8f3e1fe33c1c955ac | 8,707 | require 'sinatra_helper'
describe HieravizApp::ApiV1 do
context 'page not found' do
describe 'GET /v1/blahblah' do
let(:expected) { { 'error' => 'Endpoint not found' } }
before do
get '/blahblah'
end
it { expect(last_response).not_to be_ok }
it { expect(JSON.parse(last_respo... | 29.023333 | 70 | 0.511428 |
1a7f856777cf9086aafd4cebcf4f7a7b24c6a4a1 | 2,906 | require 'helper'
require 'net/http'
require 'ddtrace'
require 'ddtrace/contrib/rack/middlewares'
require 'rack/test'
class RackBaseTest < Minitest::Test
include Rack::Test::Methods
# rubocop:disable Metrics/MethodLength
def app
tracer = @tracer
# rubocop:disable Metrics/BlockLength
Rack::Builder.n... | 26.907407 | 81 | 0.584997 |
795a6615acb53807ec7ae3475be4426660e9d545 | 14,230 | # frozen_string_literal: true
describe RuboCop::Cop::Layout::IndentationConsistency, :config do
subject(:cop) { described_class.new(config) }
let(:cop_config) { { 'EnforcedStyle' => 'normal' } }
context 'with if statement' do
it 'registers an offense for bad indentation in an if body' do
expect_offen... | 23.213703 | 80 | 0.525861 |
6a067c439b2ebd79b787c69fce833c4d38ac6160 | 1,303 | class Object
def to_pdx
inspect
end
end
class Symbol
def to_pdx
self.to_s
end
def quote
self.to_s.quote
end
def literal
self.to_s.literal
end
end
class String
prepend Paradoxical::Elements::Concerns::Impersonator::NativeComparisons
IS_VALID_RAW_STRING_REGEXP = /^(hidden:eve... | 17.373333 | 131 | 0.693016 |
3313220243a710801a1c8cfb9f5fed7ea0a89182 | 7,601 | # Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
# Add URL safe Base64 support
module Base64
module_function
# Returns the Base64-encoded version of +bin+.
# This method complies with RFC 4648.
# No line fe... | 31.151639 | 167 | 0.652677 |
399208e40d7f0d316b22105a8445aa61175ea89b | 1,570 | require 'spec_helper'
describe Rails3::Plugin::Extender do
describe '#extend_rails' do
it "should extend Action View" do
extender = Rails3::Plugin::Extender.new
extender.extend_rails :view do
with MyAddition
after :initialize do
MyAddition.say 'view it!'
... | 25.322581 | 77 | 0.590446 |
39634aec2db2b45801f6ebacc0ab4c5c6da0fb42 | 1,193 | # Copyright (c) 2015 VMware, Inc. All Rights Reserved.
require_relative "../../../../base"
describe "VagrantPlugins::GuestPhoton::Cap::ChangeHostName" do
let(:caps) do
VagrantPlugins::GuestPhoton::Plugin
.components
.guest_capabilities[:photon]
end
let(:machine) { double("machine") }
let(:com... | 27.744186 | 84 | 0.668902 |
08a0cc9c5f6800b3cd748fce2823e9f86e14313f | 2,295 | name 'Azure Add vNet DNS Test'
rs_ca_ver 20161221
short_description 'Azure Add vNet DNS - Test CAT'
import 'sys_log'
import 'plugins/rs_azure_networking_plugin'
parameter 'subscription_id' do
like $rs_azure_networking_plugin.subscription_id
end
permission 'read_creds' do
actions 'rs_cm.show_sensitive','rs_cm.i... | 29.050633 | 103 | 0.667974 |
116edfdb2983227ae56c796295d722eaeb59b5c7 | 557 | Forem::Category.create(:name => 'General')
user = Forem.user_class.first
unless user.nil?
forum = Forem::Forum.find_or_create_by_name(:category_id => Forem::Category.first.id,
:name => "Default",
:description => "Default forem created by install")
pos... | 29.315789 | 88 | 0.642729 |
03ac829bfb2ee9faffb23abcbb91d5c16a7a2013 | 1,054 | require "formula"
class WindowsExploitSuggester < Formula
homepage "https://github.com/GDSSecurity/Windows-Exploit-Suggester"
url "https://github.com/GDSSecurity/Windows-Exploit-Suggester", :using => :git, :revision => '776bd91'
version "33"
revision 1
resource "xlrd" do
url "https://pypi.python.org/pac... | 34 | 127 | 0.740987 |
e994c79a3c6bfb13877002a5b4ddc4b34df6aa1e | 42 | module BlankSlate
VERSION = "1.1.2"
end
| 10.5 | 19 | 0.690476 |
bfb7c8ce75a5b2980a165c98ff6d1bdb5cbc175b | 1,023 |
xdescribe hornerMethod do
it 'should evaluate the polynomial for the specified value of x correctly' do
expect(hornerMethod([8], 0.1)).to eq 8
expect(hornerMethod([2, 4, 2, 5], 0.555)).to eq 7.68400775
expect(hornerMethod([2, 4, 2, 5], 0.75)).to eq 9.59375
expect(hornerMethod([1, 1, 1, 1, 1], 1.7... | 46.5 | 91 | 0.647116 |
e87ecada2e8e49adb29dce202b2b7bbe5bebe20b | 1,476 | require 'spec_helper_integration'
class Doorkeeper::OAuth::ClientCredentialsRequest
describe Creator do
let(:client) { FactoryBot.create :application }
let(:scopes) { Doorkeeper::OAuth::Scopes.from_string('public') }
before do
default_scopes_exist :public
end
it 'creates a new token' do
... | 30.122449 | 89 | 0.688347 |
03dfa88c01f2924f96fb4dcde41cd91573e43e59 | 3,069 | require_relative '../helper'
require 'fluent/plugin_helper/timer'
require 'fluent/plugin/base'
class TimerTest < Test::Unit::TestCase
class Dummy < Fluent::Plugin::TestBase
helpers :timer
end
test 'can be instantiated under state that timer is not running' do
d1 = Dummy.new
assert d1.respond_to?(:ti... | 23.075188 | 123 | 0.641251 |
ab69d75f5388d8014f13ec9f711ed628b5a82ae6 | 517 | # -*- encoding : utf-8 -*-
class Users::OmniauthCancelCallbacksController < DeviseController
def self.provides_cancel_callback_for(*args)
args[0].each do |provider, uid|
class_eval <<-EVAL, __FILE__, __LINE__ + 1
def #{provider}
if record = Authorization.where(:provider => #{provider}, :u... | 24.619048 | 98 | 0.628627 |
619333636e79cd259fdaa51b8e393b2702bee562 | 634 | module DSCConnect
class RequestCommand < Command
attr_reader :code, :raw_data, :checksum, :command, :name, :data
REQUEST_COMMANDS ||= YAML.load_file(File.join(File.dirname(__FILE__), 'commands.yml'))['request']
def initialize(command, **data)
super()
@command = command.to_s
@data = dat... | 33.368421 | 101 | 0.660883 |
91e5613beebfd66df081dd747348dbf3693bf639 | 747 | cask 'flash-player-debugger' do
version '32.0.0.114'
sha256 'e0fe31fa3d9a24dd1f939c0586e598960a79e4f694b19edb269d414284de919d'
url "https://fpdownload.adobe.com/pub/flashplayer/updaters/#{version.major}/flashplayer_#{version.major}_sa_debug.dmg"
appcast 'https://fpdownload.adobe.com/pub/flashplayer/update/curr... | 41.5 | 120 | 0.738956 |
617941e03f2d71cacd2153c4ac26e7de5134e39d | 1,612 | # encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
module Azure::Network::Mgmt::V2018_07_01
module Models
#
# Application Gateway autoscale bounds on number of Application Gateway
# instance.
... | 26.42623 | 75 | 0.547767 |
39c41bf675981f4043ed666574591604a767f245 | 131 | class AddPhotoColumnToVolunteers < ActiveRecord::Migration[5.0]
def change
add_column :volunteers, :photo, :string
end
end
| 21.833333 | 63 | 0.763359 |
39003be60219ce0869613fef4b6ca834b1476a94 | 3,592 | require 'spec_helper'
describe 'conference/show.html.haml' do
before(:each) do
allow(view).to receive(:date_string).and_return('January 17 - 21 2014')
@conference = create(:conference, description: 'Lorem Ipsum')
@conference.splashpage = create(:splashpage,
include_reg... | 40.359551 | 90 | 0.611915 |
618b1c802d0dfaa9732ffedee8f510e039422298 | 1,102 | module JekyllHueman
module Sitemap
class Taxonomy
attr_reader :last_modified_date
def entries
msg = "#entries must be defined by #{self.class.name} subclass!"
raise NotImplementedError, msg
end
def initialize(site)
@site = site
end
def last_modified
... | 25.045455 | 80 | 0.623412 |
6ac5dd24c8c3f81a9dc2ad3e61fafca037a13dc8 | 3,978 | require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes.rb'
describe "String#to_i" do
it "ignores leading whitespaces" do
[ " 123", " 123", "\r\n\r\n123", "\t\t123",
"\r\n\t\n123", " \t\n\r\t 123"].each do |str|
str.to_i.should == 123
end
en... | 29.909774 | 73 | 0.61086 |
4aaf5d9f9b283c3f7e0564e4c4f8ef8d70d105a5 | 430 | loop do
num = gets.to_i
break if num.zero?
count = 1 # multiplo
arr = [1] # array
(num - 1).times { arr << count *= 2 }
big = (num + 3) / 2
big -= 1 if ((1..5).cover? num) || (num == 7) || (num == 9)
# p big
num.times do
arr.each do |x|
if x == arr.last
printf "%#{big}s", x
... | 15.357143 | 61 | 0.448837 |
bb121de9a31253591a8c7098f75eaa9a7acfeccf | 615 | cask 'motion' do
version '0.3.0'
sha256 'e48718d7fcc5dc0982d0aec5828ce07d19d57eb47a2322c31c5b31a3441cd118'
# github.com/philipardeljan/getmotion was verified as official when first introduced to the cask
url "https://github.com/philipardeljan/getmotion/releases/download/v#{version}/motion.dmg"
appcast 'https... | 34.166667 | 98 | 0.715447 |
182d4097043ee92e32b1a7966deb4fcf28a2ca3f | 59,434 | # frozen_string_literal: true
#
# = Application Controller Base Class
#
# This is the base class for all the application's controllers. It contains
# all the important application-wide filters and lots of helper methods.
# Anything that appears here is available to every controller and view.
#
# == Filters
#
# ... | 33.000555 | 80 | 0.652875 |
1d8ce2020d97b13f2a572df0492bf40410251293 | 3,584 | # This file was auto-generated by lib/generators/tasks/generate.rb
module Slack
module Endpoint
module Users
#
# This method lets you find out information about a user's presence.
# Consult the presence documentation for more details.
#
# @option options [Object] :user
# Use... | 45.367089 | 101 | 0.674665 |
28ef3f845a8408d3c785efec44c133cc50d78b77 | 1,021 | module RSpec::Rails
# Extends ActionDispatch::Integration::Runner to work with RSpec.
#
# == Matchers
#
# In addition to the stock matchers from rspec-expectations, request
# specs add these matchers, which delegate to rails' assertions:
#
# response.should render_template(*args)
# => delegates to... | 26.179487 | 70 | 0.705191 |
39b6f06c4e6e4a92556eeb263a91af88b3e82fb1 | 1,194 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 35.117647 | 68 | 0.747069 |
33dd33e6a2af23fed3c2f906854d67bc5b236de6 | 10,185 | # frozen_string_literal: true
require 'rspec/core/rake_task'
require 'puppet_litmus'
require 'bolt_spec/run'
require 'open3'
require 'pdk'
require 'json'
require 'parallel'
def run_local_command(command)
stdout, stderr, status = Open3.capture3(command)
error_message = "Attempted to run\ncommand:'#{command}'\nstdo... | 43.900862 | 273 | 0.647128 |
f71ff06cde441573cbbdccd98b1c9c4019234e0b | 3,755 | module Paperclip
module Storage
# The default place to store attachments is in the filesystem. Files on the local
# filesystem can be very easily served by Apache without requiring a hit to your app.
# They also can be processed more easily after they've been saved, as they're just
# normal files. The... | 43.16092 | 109 | 0.646338 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.