Skip to content

Commit

Permalink
chore: Switch to double-quotes for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
turboladen committed Jan 18, 2023
1 parent f37fde9 commit 4cd48e0
Show file tree
Hide file tree
Showing 286 changed files with 3,919 additions and 3,916 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Naming/MethodParameterName:
Style/Documentation:
Enabled: false

Style/StringLiterals:
EnforcedStyle: double_quotes

AllCops:
DisplayCopNames: true
DisplayStyleGuide: true
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

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

# Specify your gem's dependencies in ffi-gdal.gemspec
gemspec

gem 'thor'
gem "thor"
12 changes: 6 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"

namespace :spec do
RSpec::Core::RakeTask.new(:unit) do |t|
t.pattern = 'spec/unit/**/*_spec.rb'
t.pattern = "spec/unit/**/*_spec.rb"
end

RSpec::Core::RakeTask.new(:integration) do |t|
t.pattern = 'spec/integration/**/*_spec.rb'
t.pattern = "spec/integration/**/*_spec.rb"
end

desc 'Run specs with valgrind'
desc "Run specs with valgrind"
task :valgrind do
valgrind_options = %w[
--num-callers=50
Expand All @@ -22,7 +22,7 @@ namespace :spec do
--show-leak-kinds=all
--trace-children=yes
--log-file=valgrind_output.log
].join(' ')
].join(" ")

cmd = %(valgrind #{valgrind_options} bundle exec rake spec SPEC_OPTS="--format documentation")
puts cmd
Expand Down
24 changes: 12 additions & 12 deletions bin/bundle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# this file is here to facilitate running it.
#

require 'rubygems'
require "rubygems"

m = Module.new do
module_function
Expand All @@ -18,12 +18,12 @@ m = Module.new do
end

def env_var_version
ENV.fetch('BUNDLER_VERSION', nil)
ENV.fetch("BUNDLER_VERSION", nil)
end

def cli_arg_version
return unless invoked_as_script? # don't want to hijack other binstubs
return unless 'update'.start_with?(ARGV.first || ' ') # must be running `bundle update`
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`

bundler_version = nil
update_index = nil
Expand All @@ -38,16 +38,16 @@ m = Module.new do
end

def gemfile
gemfile = ENV.fetch('BUNDLE_GEMFILE', nil)
gemfile = ENV.fetch("BUNDLE_GEMFILE", nil)
return gemfile if gemfile && !gemfile.empty?

File.expand_path('../Gemfile', __dir__)
File.expand_path("../Gemfile", __dir__)
end

def lockfile
lockfile =
case File.basename(gemfile)
when 'gems.rb' then gemfile.sub(/\.rb$/, gemfile)
when "gems.rb" then gemfile.sub(/\.rb$/, gemfile)
else "#{gemfile}.lock"
end
File.expand_path(lockfile)
Expand Down Expand Up @@ -75,27 +75,27 @@ m = Module.new do

requirement = bundler_gem_version.approximate_recommendation

return requirement unless Gem.rubygems_version < Gem::Version.new('2.7.0')
return requirement unless Gem.rubygems_version < Gem::Version.new("2.7.0")

requirement += '.a' if bundler_gem_version.prerelease?
requirement += ".a" if bundler_gem_version.prerelease?

requirement
end

def load_bundler!
ENV['BUNDLE_GEMFILE'] ||= gemfile
ENV["BUNDLE_GEMFILE"] ||= gemfile

activate_bundler
end

def activate_bundler
gem_error = activation_error_handling do
gem 'bundler', bundler_requirement
gem "bundler", bundler_requirement
end
return if gem_error.nil?

require_error = activation_error_handling do
require 'bundler/version'
require "bundler/version"
end
if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
return
Expand All @@ -120,4 +120,4 @@ end

m.load_bundler!

load Gem.bin_path('bundler', 'bundle') if m.invoked_as_script?
load Gem.bin_path("bundler", "bundle") if m.invoked_as_script?
12 changes: 6 additions & 6 deletions bin/rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path('bundle', __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
Expand All @@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
end
end

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('rake', 'rake')
load Gem.bin_path("rake", "rake")
12 changes: 6 additions & 6 deletions bin/rspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path('bundle', __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
Expand All @@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
end
end

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('rspec-core', 'rspec')
load Gem.bin_path("rspec-core", "rspec")
12 changes: 6 additions & 6 deletions bin/rubocop
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
# this file is here to facilitate running it.
#

require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)

bundle_binstub = File.expand_path('bundle', __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)

if File.file?(bundle_binstub)
if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
Expand All @@ -23,7 +23,7 @@ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this
end
end

require 'rubygems'
require 'bundler/setup'
require "rubygems"
require "bundler/setup"

load Gem.bin_path('rubocop', 'rubocop')
load Gem.bin_path("rubocop", "rubocop")
30 changes: 15 additions & 15 deletions examples/extract_and_colorize.rb
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
# frozen_string_literal: true

require 'bundler/setup'
require 'ffi-gdal'
require "bundler/setup"
require "ffi-gdal"

GDAL::Logger.logging_enabled = true

colors = %w[644d1e 745924 856728 95742b a5812d b69930 c8b22d d8cb3c e8e65a
f4ee79 e0e457 c8da42 afd135 97b73c 7e993c 657e36 4b612c 314441 23295e
282973]

floyd_path = File.join(__dir__, '../spec/support/images/Floyd/Floyd_1058_20140612_NRGB.tif')
floyd = GDAL::Dataset.open(floyd_path, 'r')
floyd_path = File.join(__dir__, "../spec/support/images/Floyd/Floyd_1058_20140612_NRGB.tif")
floyd = GDAL::Dataset.open(floyd_path, "r")

#---
# Extracting...
#---

# NIR
floyd.extract_nir('nir.tif', 1).close
floyd.extract_nir("nir.tif", 1).close

# Natural Color
floyd.extract_natural_color('nc.tif', band_order: %i[nir red green blue]).close
floyd.extract_natural_color("nc.tif", band_order: %i[nir red green blue]).close

# NDVI as Float32
floyd.extract_ndvi('ndvi_float.tif', band_order: %i[nir red green blue],
floyd.extract_ndvi("ndvi_float.tif", band_order: %i[nir red green blue],
data_type: :GDT_Float32,
remove_negatives: true).close

# NDVI as Byte
floyd.extract_ndvi('ndvi_byte.tif', band_order: %i[nir red green blue],
floyd.extract_ndvi("ndvi_byte.tif", band_order: %i[nir red green blue],
data_type: :GDT_Byte,
remove_negatives: true,
photometric: 'PALETTE').close
photometric: "PALETTE").close

# NDVI as UInt16
floyd.extract_ndvi('ndvi_uint16.tif', band_order: %i[nir red green blue],
floyd.extract_ndvi("ndvi_uint16.tif", band_order: %i[nir red green blue],
data_type: :GDT_UInt16,
remove_negatives: true,
photometric: 'PALETTE').close
photometric: "PALETTE").close

#---
# Colorize after extraction...
#---

byte_dataset = GDAL::Dataset.open('ndvi_byte.tif', 'w')
byte_dataset = GDAL::Dataset.open("ndvi_byte.tif", "w")
byte_band = byte_dataset.raster_band(1)
byte_band.colorize!(*colors)
byte_dataset.close

uint16_dataset = GDAL::Dataset.open('ndvi_uint16.tif', 'w')
uint16_dataset = GDAL::Dataset.open("ndvi_uint16.tif", "w")
uint16_band = uint16_dataset.raster_band(1)
uint16_band.colorize!(*colors)
uint16_dataset.close

g_byte_dataset = GDAL::Dataset.open('gndvi_byte.tif', 'w')
g_byte_dataset = GDAL::Dataset.open("gndvi_byte.tif", "w")
g_byte_band = g_byte_dataset.raster_band(1)
g_byte_band.colorize!(*colors)
g_byte_dataset.close

g_uint16_dataset = GDAL::Dataset.open('gndvi_uint16.tif', 'w')
g_uint16_dataset = GDAL::Dataset.open("gndvi_uint16.tif", "w")
g_uint16_band = g_uint16_dataset.raster_band(1)
g_uint16_band.colorize!(*colors)
g_uint16_dataset.close
24 changes: 12 additions & 12 deletions examples/geometries.rb
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# frozen_string_literal: true

require 'bundler/setup'
require 'ffi-gdal'
require 'ogr'
require "bundler/setup"
require "ffi-gdal"
require "ogr"

_data_source = OGR::DataSource.open('spec/support/shapefiles/states_21basic/states.shp', 'r')
_data_source = OGR::DataSource.open("spec/support/shapefiles/states_21basic/states.shp", "r")

point_wkt = 'POINT (1 2)'
point_wkt = "POINT (1 2)"
_point = OGR::Geometry.create_from_wkt(point_wkt)
_other_point_wkt = 'POINT (1 2)'
_other_point_wkt = "POINT (1 2)"
_other_point = OGR::Geometry.create_from_wkt(point_wkt)

line_string_wkt = 'LINESTRING (1 2, 10 30, 40 40, 1 2)'
line_string_wkt = "LINESTRING (1 2, 10 30, 40 40, 1 2)"
_line_string = OGR::Geometry.create_from_wkt(line_string_wkt)
other_line_string_wkt = 'LINESTRING (10 10, 0 30, 40 10)'
other_line_string_wkt = "LINESTRING (10 10, 0 30, 40 10)"
_other_line_string = OGR::Geometry.create_from_wkt(other_line_string_wkt)

polygon_wkt = 'POLYGON ((0 0,4 0,4 4,0 4,0 0), (1 1, 2 1, 2 2, 1 1))'
polygon_wkt = "POLYGON ((0 0,4 0,4 4,0 4,0 0), (1 1, 2 1, 2 2, 1 1))"
_polygon = OGR::Geometry.create_from_wkt(polygon_wkt)
other_polygon_wkt = 'POLYGON ((1 1,5 1,5 5,1 5,1 1), (10 10, 20 10, 20 20, 10 10))'
other_polygon_wkt = "POLYGON ((1 1,5 1,5 5,1 5,1 1), (10 10, 20 10, 20 20, 10 10))"
_other_polygon = OGR::Geometry.create_from_wkt(other_polygon_wkt)

multi_point_wkt = 'MULTIPOINT ((10 40), (40 30), (20 20), (30 10))'
multi_point_wkt = "MULTIPOINT ((10 40), (40 30), (20 20), (30 10))"
_multi_point = OGR::Geometry.create_from_wkt(multi_point_wkt)

multi_line_string_wkt = 'MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))'
multi_line_string_wkt = "MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))"
_multi_line_string = OGR::Geometry.create_from_wkt(multi_line_string_wkt)

multi_polygon_wkt = <<-WKT
Expand Down
Loading

0 comments on commit 4cd48e0

Please sign in to comment.