metanorma / atmospheric

International Standard Atmosphere / ICAO Standard Atmosphere (ISA) from ICAO 7488 / ISO 2533
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Fix rubocop issues #14

Closed ronaldtse closed 7 months ago

ronaldtse commented 7 months ago

There are a number of complaints from Rubocop. We need to fix all of them.

Offenses:

lib/atmospheric/isa.rb:14:12: C: Use a mantissa in [1, 10[.
      N_A: 602.257e21,
           ^^^^^^^^^^
lib/atmospheric/isa.rb:87:11: C: Use snake_case for method names.
      def temperature_at_layer_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:142:7: C: Assignment Branch Condition size for pressure_layers is too high. [<16, 19, 9> 26.42/15]
      def pressure_layers ...
      ^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:142:7: C: Method has too many lines. [37/10]
      def pressure_layers ...
      ^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:142:7: C: Perceived complexity for pressure_layers is too high. [8/7]
      def pressure_layers ...
      ^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:148:9: C: Block has too many lines. [31/25]
        TEMPERATURE_LAYERS.each_with_index do |_x, i| ...
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:189:41: C: Method parameter must be at least 3 characters long.
      def pressure_formula_beta_nonzero(pb, beta, temp, height_diff)
                                        ^^
lib/atmospheric/isa.rb:190:81: C: Line is too long. [85/80]
        pb * (1 + ((beta / temp) * height_diff))**(-CONST[:g_n] / (beta * CONST[:R]))
                                                                                ^^^^^
lib/atmospheric/isa.rb:194:38: C: Method parameter must be at least 3 characters long.
      def pressure_formula_beta_zero(pb, temp, height_diff)
                                     ^^
lib/atmospheric/isa.rb:210:7: C: Method has too many lines. [23/10]
      def pressure_from_H(geopotential_alt) ...
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:210:11: C: Use snake_case for method names.
      def pressure_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:237:11: C: Use snake_case for method names.
      def pressure_from_H_mbar(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:241:11: C: Use snake_case for method names.
      def pressure_from_H_mmhg(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:245:11: C: Use snake_case for method names.
      def p_p_n_from_H(geopotential_alt)
          ^^^^^^^^^^^^
lib/atmospheric/isa.rb:254:11: C: Use snake_case for method names.
      def density_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:261:11: C: Use snake_case for method names.
      def rho_rho_n_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:265:11: C: Use snake_case for method names.
      def root_rho_rho_n_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:272:11: C: Use snake_case for method names.
      def specific_weight_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:284:11: C: Use snake_case for method names.
      def pressure_scale_height_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:292:11: C: Use snake_case for method names.
      def air_number_density_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:307:11: C: Use snake_case for method names.
      def mean_air_particle_speed_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:315:11: C: Use snake_case for method names.
      def mean_free_path_of_air_particles_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:316:43: C: Use a mantissa in [1, 10[.
        1 / (1.414213562 * 3.141592654 * (0.365e-9**2) * \
                                          ^^^^^^^^
lib/atmospheric/isa.rb:323:54: C: Method parameter must be at least 3 characters long.
      def air_particle_collision_frequency_from_temp(n, temp)
                                                     ^
lib/atmospheric/isa.rb:324:14: C: Use a mantissa in [1, 10[.
        4 * (0.365e-9**2) *
             ^^^^^^^^
lib/atmospheric/isa.rb:329:11: C: Use snake_case for method names.
      def air_particle_collision_frequency_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:345:11: C: Use snake_case for method names.
      def speed_of_sound_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:361:11: C: Use snake_case for method names.
      def dynamic_viscosity_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:373:11: C: Use snake_case for method names.
      def kinematic_viscosity_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/atmospheric/isa.rb:385:11: C: Use snake_case for method names.
      def thermal_conductivity_from_H(geopotential_alt)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^

10 files inspected, 30 offenses detected
newbthenewbd commented 7 months ago

This snake_case thing looks a little problematic... h is not H, I guess all the from_H could be changed to at_geopotential? Still breaks the API :)

ronaldtse commented 7 months ago

Done in #16 and #21