Sha256: b163e93506f579fb62c83e57302aa99b7ed3dd0cc5fe9420473bebad0b55a215

Contents?: true

Size: 687 Bytes

Versions: 10

Compression:

Stored size: 687 Bytes

Contents

# frozen_string_literal: true
module ThemeCheck
  # Reports missing shopify required directories

  class RequiredDirectories < LiquidCheck
    severity :error
    category :liquid
    doc "https://shopify.dev/tutorials/develop-theme-files"

    REQUIRED_DIRECTORIES = %w(assets config layout locales sections snippets templates)

    def on_end
      directories = theme.directories.map(&:to_s)
      missing_directories = REQUIRED_DIRECTORIES - directories
      missing_directories.each { |d| add_missing_directories_offense(d) }
    end

    private

    def add_missing_directories_offense(directory)
      add_offense("Theme is missing '#{directory}' directory")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
theme-check-0.4.0 lib/theme_check/checks/required_directories.rb
theme-check-0.3.3 lib/theme_check/checks/required_directories.rb
theme-check-0.3.2 lib/theme_check/checks/required_directories.rb
theme-check-0.3.1 lib/theme_check/checks/required_directories.rb
theme-check-0.3.0 lib/theme_check/checks/required_directories.rb
theme-check-0.2.2 lib/theme_check/checks/required_directories.rb
theme-check-0.2.0 lib/theme_check/checks/required_directories.rb
theme-check-0.1.2 lib/theme_check/checks/required_directories.rb
theme-check-0.1.1 lib/theme_check/checks/required_directories.rb
theme-check-0.1.0 lib/theme_check/checks/required_directories.rb