Skip to content

Do not use global variables, use constants #10

@greyblake

Description

@greyblake

In general it's a bad practise.

require 'figo'

$api_endpoint
 => "api.figo.me" 

$valid_fingerprints
 => ["3A:62:54:4D:86:B4:34:38:EA:34:64:4E:95:10:A9:FF:37:27:69:C0", "CF:C1:BC:7F:6A:16:09:2B:10:83:8A:B0:22:4F:3A:65:D2:70:D7:3E"]

Also the names are not prefixed, some potentially some other libary can introduce $api_endpoint variable, what can result into errors.

It's better to use constants:

module Figo
  API_ENDPOINT = "api.figo.me".freeze
  VALID_FINGERPRINTS = [
    "3A:62:54:4D:86:B4:34:38:EA:34:64:4E:95:10:A9:FF:37:27:69:C0",
    "CF:C1:BC:7F:6A:16:09:2B:10:83:8A:B0:22:4F:3A:65:D2:70:D7:3E"
  ].freeze
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions