mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Ruby: Remove unused test files
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
class DummyComponent < ViewComponent::Base
|
||||
end
|
||||
@@ -1,52 +0,0 @@
|
||||
Rails.application.routes.draw do
|
||||
resources :posts, only: [:show, :index] do
|
||||
resources :comments do
|
||||
resources :replies, only: [:create]
|
||||
post "flag", to: :flag
|
||||
end
|
||||
post "upvote", to: "posts#upvote"
|
||||
end
|
||||
|
||||
if Rails.env.test?
|
||||
post "destroy_all_posts", to: "posts#destroy_alll"
|
||||
end
|
||||
|
||||
constraints(number: /[0-9]+/) do
|
||||
get "/numbers/:number", to: "numbers#show"
|
||||
end
|
||||
|
||||
scope path: "/admin" do
|
||||
get "/jobs", to: "background_jobs#index"
|
||||
end
|
||||
|
||||
scope "/admin" do
|
||||
get "secrets", controller: "secrets", action: "view_secrets"
|
||||
delete ":user_id", to: "users#destroy"
|
||||
end
|
||||
|
||||
match "photos/:id" => "photos#show", via: :get
|
||||
match "photos/:id", to: "photos#show", via: :get
|
||||
match "photos/:id", controller: "photos", action: "show", via: :get
|
||||
match "photos/:id", to: "photos#show", via: :all
|
||||
|
||||
scope controller: "users" do
|
||||
post "upgrade", action: "start_upgrade"
|
||||
end
|
||||
|
||||
scope module: "enterprise", controller: "billing" do
|
||||
get "current_billing_cycle"
|
||||
end
|
||||
|
||||
resource :global_config, only: [:show]
|
||||
|
||||
namespace :foo do
|
||||
resources :bar, only: [:index, :show] do
|
||||
get "show_debug", to: :show_debug
|
||||
end
|
||||
end
|
||||
|
||||
scope "/users/:user" do
|
||||
delete "/notifications", to: "users/notifications#destroy", as: :user_destroy_notifications
|
||||
post "notifications/:notification_id/mark_as_read", to: "users/notifications#mark_as_read"
|
||||
end
|
||||
end
|
||||
@@ -1,40 +0,0 @@
|
||||
class CommentsController < ApplicationController
|
||||
def index
|
||||
request.params
|
||||
request.parameters
|
||||
request.GET
|
||||
request.POST
|
||||
request.query_parameters
|
||||
request.request_parameters
|
||||
request.filtered_parameters
|
||||
|
||||
response.body = "some content"
|
||||
|
||||
response.status = 200
|
||||
|
||||
response.header["Content-Type"] = "text/html"
|
||||
response.set_header("Content-Length", 100)
|
||||
response.headers["X-Custom-Header"] = "hi"
|
||||
response["X-Another-Custom-Header"] = "yes"
|
||||
response.add_header "X-Yet-Another", "indeed"
|
||||
|
||||
response.send_file("my-file.ext")
|
||||
|
||||
response.request
|
||||
|
||||
response.location = "http://..." # relevant for url redirect query
|
||||
response.cache_control = "value"
|
||||
response._cache_control = "value"
|
||||
response.etag = "value"
|
||||
response.charset = "value" # sets the charset part of the content-type header
|
||||
response.content_type = "value" # sets the main part of the content-type header
|
||||
|
||||
response.date = Date.today
|
||||
response.last_modified = Date.yesterday
|
||||
response.weak_etag = "value"
|
||||
response.strong_etag = "value"
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
end
|
||||
@@ -1,46 +0,0 @@
|
||||
require 'json'
|
||||
|
||||
class BarsController < ApplicationController
|
||||
|
||||
def index
|
||||
render template: "foo/bars/index"
|
||||
end
|
||||
|
||||
def show_debug
|
||||
user_info = JSON.load cookies[:user_info]
|
||||
puts "User: #{user_info['name']}"
|
||||
|
||||
@user_website = params[:website]
|
||||
dt = params[:text]
|
||||
rendered = render_to_string "foo/bars/show", locals: { display_text: dt, safe_text: "hello" }
|
||||
puts rendered
|
||||
redirect_to action: "show"
|
||||
end
|
||||
|
||||
def show
|
||||
@user_website = params[:website]
|
||||
dt = params[:text]
|
||||
render "foo/bars/show", locals: { display_text: dt, safe_text: "hello" }
|
||||
end
|
||||
|
||||
def go_back
|
||||
redirect_back_or_to action: "index"
|
||||
end
|
||||
|
||||
def go_back_2
|
||||
redirect_back fallback_location: { action: "index" }
|
||||
end
|
||||
|
||||
def show_2
|
||||
render json: { some: "data" }
|
||||
body = render_to_string @user, content_type: "application/json"
|
||||
rescue => e
|
||||
render e.backtrace, content_type: "text/plain"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def unreachable_action
|
||||
render "show"
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
class PhotosController < ApplicationController
|
||||
def show
|
||||
end
|
||||
end
|
||||
@@ -1,10 +0,0 @@
|
||||
class PostsController < ApplicationController
|
||||
def index
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
def upvote
|
||||
end
|
||||
end
|
||||
@@ -1,2 +0,0 @@
|
||||
class TagsController < ActionController::Metal
|
||||
end
|
||||
@@ -1,6 +0,0 @@
|
||||
module Users
|
||||
class NotificationsController < ApplicationController
|
||||
def mark_as_read
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
module Mutations
|
||||
class BaseMutation < GraphQL::Schema::RelayClassicMutation
|
||||
argument_class Types::BaseArgument
|
||||
field_class Types::BaseField
|
||||
input_object_class Types::BaseInputObject
|
||||
object_class Types::BaseObject
|
||||
end
|
||||
end
|
||||
@@ -1,14 +0,0 @@
|
||||
module Mutations
|
||||
class Dummy < BaseMutation
|
||||
argument :something_id, ID, required: false
|
||||
|
||||
def load_something(id)
|
||||
"Something number #{id}"
|
||||
end
|
||||
|
||||
def resolve(something:)
|
||||
system("echo #{something}")
|
||||
{ success: true }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
module Resolvers
|
||||
class Base < GraphQL::Schema::Resolver
|
||||
end
|
||||
end
|
||||
@@ -1,15 +0,0 @@
|
||||
module Resolvers
|
||||
class DummyResolver < Resolvers::Base
|
||||
type String, null: false
|
||||
argument :something_id, ID, required: true
|
||||
|
||||
def load_something(id)
|
||||
"Something number #{id}"
|
||||
end
|
||||
|
||||
def resolve(something:)
|
||||
system("echo #{something}")
|
||||
"true"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
module Types
|
||||
class BaseArgument < GraphQL::Schema::Argument
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
module Types
|
||||
class BaseField < GraphQL::Schema::Field
|
||||
argument_class Types::BaseArgument
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
module Types
|
||||
class BaseInputObject < GraphQL::Schema::InputObject
|
||||
argument_class Types::BaseArgument
|
||||
end
|
||||
end
|
||||
@@ -1,7 +0,0 @@
|
||||
module Types
|
||||
module BaseInterface
|
||||
include GraphQL::Schema::Interface
|
||||
|
||||
field_class Types::BaseField
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
module Types
|
||||
class BaseObject < GraphQL::Schema::Object
|
||||
field_class Types::BaseField
|
||||
end
|
||||
end
|
||||
@@ -1,5 +0,0 @@
|
||||
module Types
|
||||
class MutationType < Types::BaseObject
|
||||
field :dummy, mutation: Mutations::Dummy
|
||||
end
|
||||
end
|
||||
@@ -1,46 +0,0 @@
|
||||
module Types
|
||||
class QueryType < Types::BaseObject
|
||||
field :test_field, String, null: false,
|
||||
description: "An example field added by the generator",
|
||||
resolver: Resolvers::DummyResolver
|
||||
|
||||
field :with_arg, String, null: false, description: "A field with an argument" do
|
||||
argument :number, Int, "A number", required: true
|
||||
end
|
||||
def with_arg(number:)
|
||||
system("echo #{number}")
|
||||
number.to_s
|
||||
end
|
||||
|
||||
field :with_method, String, null: false, description: "A field with a custom resolver method", resolver_method: :custom_method do
|
||||
argument :blah_number, Int, "A number", required: true
|
||||
end
|
||||
def custom_method(blah_number:, number: nil)
|
||||
system("echo #{blah_number}")
|
||||
system("echo #{number}")
|
||||
blah_number.to_s
|
||||
end
|
||||
|
||||
field :with_splat, String, null: false, description: "A field with a double-splatted argument" do
|
||||
argument :something, Int, "A number", required: true
|
||||
end
|
||||
def with_splat(**args)
|
||||
system("echo #{args[:something]}")
|
||||
args[:something].to_s
|
||||
end
|
||||
|
||||
field :with_splat_and_named_arg, String, null: false, description: "A field with two named arguments, where the method captures the second via a hash splat param" do
|
||||
argument :arg1, Int, "A number", required: true
|
||||
argument :arg2, Int, "Another number", required: true
|
||||
end
|
||||
def with_splat_and_named_arg(arg1:, **rest)
|
||||
system("echo #{arg1}")
|
||||
system("echo #{rest[:arg2]}")
|
||||
arg1.to_s
|
||||
end
|
||||
|
||||
def foo(arg)
|
||||
system("echo #{arg}")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,4 +0,0 @@
|
||||
<%= raw @display_text %>
|
||||
<%= raw display_text %>
|
||||
<%= raw locals[:display_text] %>
|
||||
<%= @display_text %>
|
||||
@@ -1,33 +0,0 @@
|
||||
<a href="<%= raw user_website %>">website</a>
|
||||
<%= raw @display_text %>
|
||||
<%= raw display_text %>
|
||||
<%= raw locals[:display_text] %>
|
||||
<%= raw params[:text] %>
|
||||
<% key = :display_text %>
|
||||
<%= raw locals[key] %>
|
||||
|
||||
<ul>
|
||||
<% key = [:display_text, :safe_text] do
|
||||
<li><%= raw locals[key] %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= @display_text %>
|
||||
|
||||
<%=
|
||||
full_text = prefix + locals[:display_text]
|
||||
full_text
|
||||
%>
|
||||
|
||||
<%=
|
||||
@display_text.html_safe
|
||||
%>
|
||||
|
||||
<%=
|
||||
@display_text.html_safe
|
||||
@display_text
|
||||
%>
|
||||
|
||||
<%= render partial: 'foo/bars/widget', locals: { display_text: "widget_" + display_text } %>
|
||||
|
||||
<%= link_to "some website", @user_website %>
|
||||
Reference in New Issue
Block a user