forked from tuist/tuist
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move Fourier to projects * Add command to lint the Swift code * Add command to lint fourier's code * Add command to format Swift's code * Update git hook to run fourier * Add tests * Fix the fourier path * Add command to test Tuist
- Loading branch information
Pedro Piñera Buendía
authored
Mar 17, 2021
1 parent
9c1db84
commit cbc4e46
Showing
67 changed files
with
317 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
(env/prepend-to-pathlist "PATH" (expand-path "./bin")) | ||
(env/prepend-to-pathlist "PATH" (expand-path ".")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#!/bin/bash | ||
|
||
script/code_style.sh | ||
./fourier lint tuist | ||
./fourier lint fourier | ||
./fourier format tuist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
module Fourier | ||
module Commands | ||
class Format < Base | ||
desc "tuist", "Format the source code of the Tuist CLI" | ||
option :fix, desc: "When passed, it fixes the issues", type: :boolean, default: false | ||
def tuist | ||
Services::Format::Tuist.call(fix: options[:fix]) | ||
end | ||
end | ||
end | ||
end |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
module Fourier | ||
module Commands | ||
class Lint < Base | ||
desc "tuist", "Lint the source code of the Tuist CLI" | ||
option :fix, desc: "When passed, it fixes the issues", type: :boolean, default: false | ||
def tuist | ||
Services::Lint::Tuist.call(fix: options[:fix]) | ||
end | ||
|
||
desc "fourier", "Lint the source code of the Fourier CLI" | ||
option :fix, desc: "When passed, it fixes the issues", type: :boolean, default: false | ||
def fourier | ||
Services::Lint::Fourier.call(fix: options[:fix]) | ||
end | ||
|
||
desc "all", "Lint all the code in the repository" | ||
option :fix, desc: "When passed, it fixes the issues", type: :boolean, default: false | ||
def all | ||
Services::Lint::Tuist.call(fix: options[:fix]) | ||
Services::Lint::Fourier.call(fix: options[:fix]) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
module Fourier | ||
module Services | ||
class Base | ||
def self.call(*args, &block) | ||
new(*args).call(&block) | ||
end | ||
|
||
def call | ||
raise NotImplementedError | ||
end | ||
|
||
def root_directory | ||
Fourier::Constants::ROOT_DIRECTORY | ||
end | ||
|
||
def fourier_directory | ||
File.join(Fourier::Constants::ROOT_DIRECTORY, "projects/fourier") | ||
end | ||
|
||
def tuist_directory | ||
File.join(Fourier::Constants::ROOT_DIRECTORY) | ||
end | ||
|
||
def vendor_path(path) | ||
File.join(Fourier::Constants::VENDOR_DIRECTORY, path) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
module Fourier | ||
module Services | ||
module Format | ||
class Tuist < Base | ||
attr_reader :fix | ||
|
||
def initialize(fix:) | ||
@fix = fix | ||
end | ||
|
||
def call | ||
Dir.chdir(tuist_directory) do | ||
arguments = [vendor_path("swiftformat"), ".", "--quiet"] | ||
unless fix | ||
arguments << "--lint" | ||
end | ||
Fourier::Utilities::System.system(*arguments) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
module Fourier | ||
module Services | ||
module Lint | ||
class Fourier < Base | ||
attr_reader :fix | ||
|
||
def initialize(fix:) | ||
@fix = fix | ||
end | ||
|
||
def call | ||
Dir.chdir(fourier_directory) do | ||
gem_path = Gem.loaded_specs["rubocop"].full_gem_path | ||
executable_path = File.join(gem_path, "exe/rubocop") | ||
arguments = [executable_path] | ||
arguments << "-A" if fix | ||
Utilities::System.system(*arguments) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.