diff --git a/.ameba.yml b/.ameba.yml index 6d2bce0f5..a3401d7a9 100644 --- a/.ameba.yml +++ b/.ameba.yml @@ -1,6 +1,3 @@ -Documentation/DocumentationAdmonition: - Enabled: false - Metrics/CyclomaticComplexity: Enabled: false diff --git a/README.md b/README.md index 20dcaddf3..d50ac7334 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Here are some bigger projects built and maintained by us that showcases the lang - [Mint Realworld](https://github.com/mint-lang/mint-realworld) - The frontend implementation of the Realworld app. - [Mint UI](https://github.com/mint-lang/mint-ui) - A UI library written in Mint. - [Mint UI Website](https://github.com/mint-lang/mint-ui-website) - The website for Mint UI. -- _Your Project_ - let us know if you writter something amazing with Mint and would like to showcase here! +- _Your Project_ - let us know if you've written something amazing with Mint and would like to showcase here! ## 👥 Community diff --git a/core/source/File.mint b/core/source/File.mint index faa0525cb..2dffe49f0 100644 --- a/core/source/File.mint +++ b/core/source/File.mint @@ -217,7 +217,7 @@ module File { */ fun fromUrl (url : String) : Promise(Maybe(File)) { let filename = - Array.last(String.split(Url.parse(url).path, "/")) or "unkown" + Array.last(String.split(Url.parse(url).path, "/")) or "unknown" ` (async () => { diff --git a/core/source/Http.mint b/core/source/Http.mint index 095552efc..b1d85a946 100644 --- a/core/source/Http.mint +++ b/core/source/Http.mint @@ -164,7 +164,7 @@ store Http { } /* - Checks the prescence of a header with the key. + Checks the presence of a header with the key. Http.empty() |> Http.header("Content-Type", "application/json") diff --git a/core/source/MutationObserver.mint b/core/source/MutationObserver.mint index 40d8faabd..515ccd5b9 100644 --- a/core/source/MutationObserver.mint +++ b/core/source/MutationObserver.mint @@ -1,4 +1,4 @@ -/* A data structure for the mutation obeservers entry. */ +/* A data structure for the mutation observers entry. */ type MutationObserver.Entry { target : Dom.Element, type : String diff --git a/core/source/Provider/Shortcuts.mint b/core/source/Provider/Shortcuts.mint index deb910ad6..33aa4051a 100644 --- a/core/source/Provider/Shortcuts.mint +++ b/core/source/Provider/Shortcuts.mint @@ -27,7 +27,7 @@ component Main { shortcuts: [ { - action: () { Window.alert("Shotcut pressed!") }, + action: () { Window.alert("Shortcut pressed!") }, shortcut: [Html.Event.CTRL, Html.Event.G], condition: () { true }, bypassFocused: false diff --git a/core/source/ResizeObserver.mint b/core/source/ResizeObserver.mint index 750179487..cab85970a 100644 --- a/core/source/ResizeObserver.mint +++ b/core/source/ResizeObserver.mint @@ -1,4 +1,4 @@ -/* A data structure for the resize obeservers entry. */ +/* A data structure for the resize observers entry. */ type ResizeObserver.Entry { dimensions : Dom.Dimensions, target : Dom.Element diff --git a/core/source/Storage/Common.mint b/core/source/Storage/Common.mint index db0207f81..18f5882f8 100644 --- a/core/source/Storage/Common.mint +++ b/core/source/Storage/Common.mint @@ -83,7 +83,7 @@ module Storage.Common { ` } - /* Returns alll the keys in the storage. */ + /* Returns all the keys in the storage. */ fun keys (storage : Storage) : Result(Storage.Error, Array(String)) { ` (() => { diff --git a/runtime/src/decoders.js b/runtime/src/decoders.js index f5ca4771c..1a45e03f2 100644 --- a/runtime/src/decoders.js +++ b/runtime/src/decoders.js @@ -13,7 +13,7 @@ const format = (value) => { }; // A class to keep the errors when decoding. It keeps track of the path -// to the nested objects for reporting purpuses. +// to the nested objects for reporting purposes. export class Error { constructor(message, path = []) { this.message = message; @@ -150,7 +150,7 @@ export const decodeString = (ok, err) => (input) => { }; // Decodes `Time` either a UNIX timestamp or any values that the -// environment can parse with the `Date` construtor. +// environment can parse with the `Date` constructor. export const decodeTime = (ok, err) => (input) => { let parsed = NaN; diff --git a/runtime/tests/debug.test.js b/runtime/tests/debug.test.js index 2d8970b82..e22537897 100644 --- a/runtime/tests/debug.test.js +++ b/runtime/tests/debug.test.js @@ -67,7 +67,7 @@ test("inspecting array", () => { expect(inspect(["Hello", "World!"])).toBe(`["Hello", "World!"]`); }); -test("inspecting unkown", () => { +test("inspecting unknown", () => { expect(inspect(Symbol("WTF"))).toBe(`{ Symbol(WTF) }`); }); diff --git a/runtime/tests/variant.test.js b/runtime/tests/variant.test.js index b85f5c23d..2710e609f 100644 --- a/runtime/tests/variant.test.js +++ b/runtime/tests/variant.test.js @@ -6,7 +6,7 @@ const TestEnum2 = variant(2); const TestEnum = variant(0); describe("equality", () => { - test("same intance equals true", () => { + test("same instance equals true", () => { expect(compare(new TestEnum(), new TestEnum())).toEqual(true); }); diff --git a/shard.lock b/shard.lock index 1a2d82e6b..b9908879e 100644 --- a/shard.lock +++ b/shard.lock @@ -6,7 +6,7 @@ shards: ameba: git: https://github.com/crystal-ameba/ameba.git - version: 1.6.4 + version: 1.7.0-dev+git.commit.37fe65d0d86477ecd6cf0bab2d519f2235fea6b5 ansi-escapes: git: https://github.com/gtramontina/ansi-escapes.cr.git diff --git a/shard.yml b/shard.yml index 2155c6cd5..831f8b63d 100644 --- a/shard.yml +++ b/shard.yml @@ -27,7 +27,7 @@ dependencies: development_dependencies: ameba: github: crystal-ameba/ameba - version: ~> 1.6.4 + branch: master targets: mint: diff --git a/spec/ast/node_spec.cr b/spec/ast/node_spec.cr index 0ab0ee116..ab53e3334 100644 --- a/spec/ast/node_spec.cr +++ b/spec/ast/node_spec.cr @@ -3,8 +3,7 @@ require "../spec_helper" describe Mint::Ast::Node do context "#contains?" do it "checks if the location is contained within the node" do - example = - <<-MINT + example = <<-MINT component Test { fun render : Html {
@@ -26,17 +25,17 @@ describe Mint::Ast::Node do {node.to.line, node.to.column}.should eq({4, 3}) # First line - node.contains?(2, 1).should eq(false) # space before `f` - node.contains?(2, 3).should eq(true) # `f` of `fun` + node.contains?(2, 1).should be_false # space before `f` + node.contains?(2, 3).should be_true # `f` of `fun` # Middle line - node.contains?(3, 0).should eq(true) - node.contains?(3, 9).should eq(true) - node.contains?(3, 1000).should eq(true) + node.contains?(3, 0).should be_true + node.contains?(3, 9).should be_true + node.contains?(3, 1000).should be_true # End line - node.contains?(4, 2).should eq(true) # `}` - node.contains?(4, 3).should eq(false) # space after `}` + node.contains?(4, 2).should be_true # `}` + node.contains?(4, 3).should be_false # space after `}` end end end diff --git a/spec/compilers/css_with_ands b/spec/compilers/css_with_and similarity index 100% rename from spec/compilers/css_with_ands rename to spec/compilers/css_with_and diff --git a/spec/errors/call_with_mixed_arguments b/spec/errors/call_with_mixed_arguments index dc1822cd4..aafa9eb9f 100644 --- a/spec/errors/call_with_mixed_arguments +++ b/spec/errors/call_with_mixed_arguments @@ -10,7 +10,7 @@ component Main { -------------------------------------------------------------------------------- ░ ERROR (CALL_WITH_MIXED_ARGUMENTS) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ -A call cannot have named and unamed arguments at the same time because in +A call cannot have named and unnamed arguments at the same time because in specific cases I cannot pair the arguments with the values. The call in question is here: diff --git a/spec/errors/component_multiple_providers b/spec/errors/component_multiple_providers index 35765a203..863da730b 100644 --- a/spec/errors/component_multiple_providers +++ b/spec/errors/component_multiple_providers @@ -9,7 +9,7 @@ component Main { -------------------------------------------------------------------------------- ░ ERROR (COMPONENT_MULTIPLE_PROVIDERS) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ -You are subcribing to the provider "Provider" in a component multiple times. +You are subscribing to the provider "Provider" in a component multiple times. A subscription is here: diff --git a/spec/errors/property_children_default_requried b/spec/errors/property_children_default_required similarity index 94% rename from spec/errors/property_children_default_requried rename to spec/errors/property_children_default_required index c506da5de..3a57af65d 100644 --- a/spec/errors/property_children_default_requried +++ b/spec/errors/property_children_default_required @@ -20,7 +20,7 @@ There should be a default value for the children property: The property in question is here: - ┌ errors/property_children_default_requried:2:3 + ┌ errors/property_children_default_required:2:3 ├────────────────────────────────────────────── 1│ component Test { 2│ property children : Array(Html) diff --git a/spec/errors/property_with_type_variables b/spec/errors/property_with_type_variables index 748f047ae..40ca73e1b 100644 --- a/spec/errors/property_with_type_variables +++ b/spec/errors/property_with_type_variables @@ -20,7 +20,7 @@ component Main { ░ ERROR (PROPERTY_WITH_TYPE_VARIABLES) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ The type of a property contains type variables. Type variables in properties are -not allow at this time since that would make the compoennt generic and it is not +not allow at this time since that would make the component generic and it is not supported this time. The type is: diff --git a/spec/errors/provider_expeceted_colon b/spec/errors/provider_expected_colon similarity index 51% rename from spec/errors/provider_expeceted_colon rename to spec/errors/provider_expected_colon index de2abb5c8..213a9ebdd 100644 --- a/spec/errors/provider_expeceted_colon +++ b/spec/errors/provider_expected_colon @@ -1,10 +1,10 @@ provider Test -------------------------------------------------------------------------------- -░ ERROR (PROVIDER_EXPECETED_COLON) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ +░ ERROR (PROVIDER_EXPECTED_COLON) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ I was expecting the colon of a provider but I found "a space" instead: - ┌ errors/provider_expeceted_colon:1:13 - ├───────────────────────────────────── + ┌ errors/provider_expected_colon:1:13 + ├──────────────────────────────────── 1│ provider Test │ ⌃⌃⌃⌃ diff --git a/spec/errors/recursion b/spec/errors/recursion index 70c98a50f..efb5fab24 100644 --- a/spec/errors/recursion +++ b/spec/errors/recursion @@ -14,8 +14,8 @@ component Main { -------------------------------------------------------------------------------- ░ ERROR (RECURSION) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ -Recursion is only supported in specific cases at this time. Unfortunatly here is -not supported: +Recursion is only supported in specific cases at this time. Unfortunately here +is not supported: ┌ errors/recursion:2:3 ├──────────────────────────────────────── diff --git a/spec/errors/unkown_builtin b/spec/errors/unknown_builtin similarity index 62% rename from spec/errors/unkown_builtin rename to spec/errors/unknown_builtin index 914c982ee..44245b19a 100644 --- a/spec/errors/unkown_builtin +++ b/spec/errors/unknown_builtin @@ -6,12 +6,12 @@ component Main { } } -------------------------------------------------------------------------------- -░ ERROR (UNKOWN_BUILTIN) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ +░ ERROR (UNKNOWN_BUILTIN) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ There is no builtin with the name: wtf - ┌ errors/unkown_builtin:3:8 - ├────────────────────────── + ┌ errors/unknown_builtin:3:8 + ├─────────────────────────── 1│ component Main { 2│ fun render : Html { 3│ `#{%wtf%}` diff --git a/spec/examples/builtin b/spec/examples/builtin index 81ea9a5cc..7afb6d9bc 100644 --- a/spec/examples/builtin +++ b/spec/examples/builtin @@ -5,7 +5,7 @@ component Main { } } -------------------------------------------------------------------unkown_builtin +----------------------------------------------------------------unknown_builtin component Main { fun render : Html { `#{%wtf%}` diff --git a/spec/examples/provider b/spec/examples/provider index 454c2c8e3..b8f98f49a 100644 --- a/spec/examples/provider +++ b/spec/examples/provider @@ -1,6 +1,6 @@ ---------------------------------------------------------provider_expected_name provider --------------------------------------------------------provider_expeceted_colon +--------------------------------------------------------provider_expected_colon provider Test -------------------------------------------------provider_expected_subscription provider Test : diff --git a/spec/examples/type_definition b/spec/examples/type_definition index 0a0603223..35f7722d3 100644 --- a/spec/examples/type_definition +++ b/spec/examples/type_definition @@ -50,14 +50,14 @@ type User { LoggedIn Guest } context User.Guest -------------------------------------------------type_defintion_context_mismatch +-----------------------------------------------type_definition_context_mismatch type User { name: String using "name", id: String } context { x: "Y" } -------------------------------------------------type_defintion_context_mismatch +-----------------------------------------------type_definition_context_mismatch type User { A } context { diff --git a/spec/examples_spec.cr b/spec/examples_spec.cr index 0a024dd97..c164cf0d1 100644 --- a/spec/examples_spec.cr +++ b/spec/examples_spec.cr @@ -4,9 +4,9 @@ path = "./spec/examples/**/*" example = nil ENV["EXAMPLE"]?.try do |item| - splitted = item.split(':', 2) - path = splitted[0] - example = splitted[1]? + split = item.split(':', 2) + path = split[0] + example = split[1]? end Dir diff --git a/spec/formatters/js_with_duble_interpolation b/spec/formatters/js_with_double_interpolation similarity index 100% rename from spec/formatters/js_with_duble_interpolation rename to spec/formatters/js_with_double_interpolation diff --git a/spec/formatters/record_destructuring b/spec/formatters/record_destructuring index e4bb86f10..a488c105f 100644 --- a/spec/formatters/record_destructuring +++ b/spec/formatters/record_destructuring @@ -10,7 +10,7 @@ module Test { case item { { name: name, age: 42 } => name - => "Unkown" + => "Unknown" } } } @@ -27,7 +27,7 @@ module Test { case item { { name: name, age: 42 } => name - => "Unkown" + => "Unknown" } } } diff --git a/spec/formatters/string_literal_split_with_interpolation b/spec/formatters/string_literal_split_with_interpolation index 79d4d1bc9..09aaefd0d 100644 --- a/spec/formatters/string_literal_split_with_interpolation +++ b/spec/formatters/string_literal_split_with_interpolation @@ -1,12 +1,12 @@ module A { fun test : String { - "Lorem ipsum dolor sit amet, consectetur adipiscing #{"WHAAT"} elit." \ " Donec pulvinar bibendum convallis. Sed malesuada commodo felis quis accumsan. Pellentesque lacinia sagittis vestibulum. Mauris aliquam a ante vel fermentum. Quisque sed consectetur elit. Donec sagittis, leo id tempus feugiat, leo ligula sollicitudin nisl, quis facilisis lorem tellus sit amet mi. Nullam vel nulla eu felis iaculis tincidunt. Nulla volutpat lorem sollicitudin finibus auctor." + "Lorem ipsum dolor sit amet, consectetur adipiscing #{"WHAT"} elit." \ " Donec pulvinar bibendum convallis. Sed malesuada commodo felis quis accumsan. Pellentesque lacinia sagittis vestibulum. Mauris aliquam a ante vel fermentum. Quisque sed consectetur elit. Donec sagittis, leo id tempus feugiat, leo ligula sollicitudin nisl, quis facilisis lorem tellus sit amet mi. Nullam vel nulla eu felis iaculis tincidunt. Nulla volutpat lorem sollicitudin finibus auctor." } } -------------------------------------------------------------------------------- module A { fun test : String { - "Lorem ipsum dolor sit amet, consectetur adipiscing #{"WHAAT"} elit. " \ + "Lorem ipsum dolor sit amet, consectetur adipiscing #{"WHAT"} elit. " \ "Donec pulvinar bibendum convallis. Sed malesuada commodo felis quis " \ "accumsan. Pellentesque lacinia sagittis vestibulum. Mauris aliquam a " \ "ante vel fermentum. Quisque sed consectetur elit. Donec sagittis, leo " \ diff --git a/spec/installer/repository_spec.cr b/spec/installer/repository_spec.cr index e35ff147d..ba5d6d467 100644 --- a/spec/installer/repository_spec.cr +++ b/spec/installer/repository_spec.cr @@ -29,11 +29,11 @@ describe "Repository" do repository = Mint::Installer::Repository.new("name", "success") message = <<-MESSAGE - ░ ERROR (REPOSITORY_NO_MINT_JSON) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ + ░ ERROR (REPOSITORY_NO_MINT_JSON) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ - I could not find the mint.json for the package: name (success) for the version - or tag: master - MESSAGE + I could not find the mint.json for the package: name (success) for the version + or tag: master + MESSAGE begin repository.json("master") @@ -48,18 +48,18 @@ describe "Repository" do repository = Mint::Installer::Repository.new("name", "error") message = <<-MESSAGE - ░ ERROR (REPOSITORY_COULD_NOT_GET_VERSIONS) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ + ░ ERROR (REPOSITORY_COULD_NOT_GET_VERSIONS) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ - I could not get the tags of the repository: error + I could not get the tags of the repository: error - The error I got from the git command is this: + The error I got from the git command is this: - 0.1.0 - 0.2.0 + 0.1.0 + 0.2.0 - Hint: Run mint tool clean; mint tool clean --package-cache to reset local - state, and then try again. - MESSAGE + Hint: Run mint tool clean; mint tool clean --package-cache to reset local + state, and then try again. + MESSAGE begin repository.versions @@ -73,14 +73,14 @@ describe "Repository" do repository = Mint::Installer::Repository.new("name", "error") message = <<-MESSAGE - ░ ERROR (REPOSITORY_COULD_NOT_CHECKOUT) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ + ░ ERROR (REPOSITORY_COULD_NOT_CHECKOUT) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ - I could not checkout the version or tag: master of the repository: error + I could not checkout the version or tag: master of the repository: error - The error I got from the git command is this: + The error I got from the git command is this: - checked out - MESSAGE + checked out + MESSAGE begin repository.checkout("master") @@ -94,17 +94,17 @@ describe "Repository" do FileUtils.rm_rf("#{tmp_dir}/cb5e100e5a9a3e7f6d1fd97512215282") message = <<-MESSAGE - ░ ERROR (REPOSITORY_COULD_NOT_CLONE) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ + ░ ERROR (REPOSITORY_COULD_NOT_CLONE) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ - I could not clone the repository: error + I could not clone the repository: error - The error I got from the git command is this: + The error I got from the git command is this: - cloned + cloned - Hint: Run mint tool clean; mint tool clean --package-cache to reset local - state, and then try again. - MESSAGE + Hint: Run mint tool clean; mint tool clean --package-cache to reset local + state, and then try again. + MESSAGE begin Mint::Installer::Repository.open("name", "error") @@ -118,17 +118,17 @@ describe "Repository" do FileUtils.mkdir_p("#{tmp_dir}/cb5e100e5a9a3e7f6d1fd97512215282") message = <<-MESSAGE - ░ ERROR (REPOSITORY_COULD_NOT_UPDATE) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ + ░ ERROR (REPOSITORY_COULD_NOT_UPDATE) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ - I could not update the repository: error + I could not update the repository: error - The error I got from the git command is this: + The error I got from the git command is this: - fetched + fetched - Hint: Run mint tool clean; mint tool clean --package-cache to reset local - state, and then try again. - MESSAGE + Hint: Run mint tool clean; mint tool clean --package-cache to reset local + state, and then try again. + MESSAGE begin Mint::Installer::Repository.open("name", "error") diff --git a/spec/mint_json/dependency_constraint_invalid b/spec/mint_json/dependency_constraint_invalid index 32d2cee9a..5e38d2522 100644 --- a/spec/mint_json/dependency_constraint_invalid +++ b/spec/mint_json/dependency_constraint_invalid @@ -9,7 +9,7 @@ -------------------------------------------------------------------------------- ░ ERROR (DEPENDENCY_CONSTRAINT_INVALID) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ -The constraint field of a depencency must be an string, but it's not: +The constraint field of a dependency must be an string, but it's not: ┌ spec/fixtures/mint.json:5:21 ├───────────────────────────── diff --git a/spec/mint_json/dependency_repository_invalid b/spec/mint_json/dependency_repository_invalid index 8b3347c30..95dbc88e3 100644 --- a/spec/mint_json/dependency_repository_invalid +++ b/spec/mint_json/dependency_repository_invalid @@ -8,7 +8,7 @@ -------------------------------------------------------------------------------- ░ ERROR (DEPENDENCY_REPOSITORY_INVALID) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ -The repository field of a depencency must be an string, but it's not: +The repository field of a dependency must be an string, but it's not: ┌ spec/fixtures/mint.json:4:21 ├───────────────────────────── diff --git a/spec/mint_json_spec.cr b/spec/mint_json_spec.cr index 0c6dd7171..bdb95476a 100644 --- a/spec/mint_json_spec.cr +++ b/spec/mint_json_spec.cr @@ -25,12 +25,12 @@ it "non existent file" do Mint::MintJson.parse("test.json") rescue error : Mint::Error error.to_terminal.to_s.uncolorize.should eq(<<-TEXT) - ░ ERROR (MINT_JSON_INVALID) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ + ░ ERROR (MINT_JSON_INVALID) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ - There was a problem trying to open a mint.json file: test.json + There was a problem trying to open a mint.json file: test.json - Error opening file with mode 'r': 'test.json': No such file or directory - TEXT + Error opening file with mode 'r': 'test.json': No such file or directory + TEXT end end @@ -39,11 +39,11 @@ it "no mint.json in directory or parents" do Mint::MintJson.parse("test.json", search: true) rescue error : Mint::Error error.to_terminal.to_s.uncolorize.should eq(<<-TEXT) - ░ ERROR (MINT_JSON_NOT_FOUND) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ + ░ ERROR (MINT_JSON_NOT_FOUND) ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ - I could not find a mint.json file in the path or any of its parent directories: + I could not find a mint.json file in the path or any of its parent directories: - test.json - TEXT + test.json + TEXT end end diff --git a/spec/spec_helper.cr b/spec/spec_helper.cr index ad3d0cd0e..d9362b72b 100644 --- a/spec/spec_helper.cr +++ b/spec/spec_helper.cr @@ -48,28 +48,28 @@ end macro subject(method) subject = ->(sample : String) { - Mint::Parser.new(sample, "TestFile.mint").{{method}} + Mint::Parser.new(sample, "TestFile.mint").{{ method }} } end macro expect_ok(sample) - it "Parses: " + {{"#{sample}"}} do - result = subject.call({{sample}}) + it "Parses: " + {{ "#{sample}" }} do + result = subject.call({{ sample }}) result.should_not be_nil result.should be_a(Mint::Ast::Node) end end macro expect_ignore(sample) - it {{"#{sample}"}} do - subject.call({{sample}}).should be_nil + it {{ "#{sample}" }} do + subject.call({{ sample }}).should be_nil end end macro expect_error(sample, error) - it {{"#{sample}"}} do - expect_raises({{error}}) do - subject.call({{sample}}) + it {{ "#{sample}" }} do + expect_raises({{ error }}) do + subject.call({{ sample }}) end end end diff --git a/spec/style_builder_spec.cr b/spec/style_builder_spec.cr index 5c02b0b99..405f9d841 100644 --- a/spec/style_builder_spec.cr +++ b/spec/style_builder_spec.cr @@ -2,56 +2,55 @@ require "./spec_helper" describe Mint::StyleBuilder do it "builds simple styles with css prefix" do - example = - <<-MINT - style test { - div, p { - background: red; - - span, strong { - pre { - color: \#{"red"}; - } + example = <<-'MINT' + style test { + div, p { + background: red; + + span, strong { + pre { + color: #{"red"}; } + } - span, strong { - pre { - background: white; + span, strong { + pre { + background: white; - @media (screen) { - color: blue; + @media (screen) { + color: blue; - a { - border: 1px solid red; - } + a { + border: 1px solid red; } } } } + } - @media (screen) { - div, p { - font-size: 30px; + @media (screen) { + div, p { + font-size: 30px; - if (true) { - color: red; - } + if (true) { + color: red; } } + } - @media (screen) { - div, p { - color: blue; - } + @media (screen) { + div, p { + color: blue; + } - @media (print) { - div, p { - color: black; - border-radius: \#{10}px; - } + @media (print) { + div, p { + color: black; + border-radius: #{10}px; } } } + } MINT parser = @@ -68,8 +67,7 @@ describe Mint::StyleBuilder do end it "optimizes class names if optimize is set" do - example = - <<-MINT + example = <<-MINT style test { div { background: red; diff --git a/spec/type_unification_spec.cr b/spec/type_unification_spec.cr index 18cdab7d5..04d468022 100644 --- a/spec/type_unification_spec.cr +++ b/spec/type_unification_spec.cr @@ -57,54 +57,54 @@ class Parser end macro expect_result(a, b, expected) - it "{{a.id}} vs {{b.id}}" do - node1 = Parser.parse({{a}}) - node2 = Parser.parse({{b}}) + it "{{ a.id }} vs {{ b.id }}" do + node1 = Parser.parse({{ a }}) + node2 = Parser.parse({{ b }}) if node1 && node2 result = Mint::TypeChecker::Comparer.compare(node1, node2) unless result - fail "Expected {{a.id}} to equal to {{b.id}} but it does not" + fail "Expected {{ a.id }} to equal to {{ b.id }} but it does not" end - result.to_s.should eq({{expected}}) + result.to_s.should eq({{ expected }}) else - fail "Could not parse {{a.id}} or {{b.id}}" + fail "Could not parse {{ a.id }} or {{ b.id }}" end end end macro expect_equal(a, b) - it "{{a.id}} vs {{b.id}}" do - node1 = Parser.parse({{a}}) - node2 = Parser.parse({{b}}) + it "{{ a.id }} vs {{ b.id }}" do + node1 = Parser.parse({{ a }}) + node2 = Parser.parse({{ b }}) if node1 && node2 result = Mint::TypeChecker::Comparer.compare(node1, node2) unless result - fail "Expected {{a.id}} to equal to {{b.id}} but it does not" + fail "Expected {{ a.id }} to equal to {{ b.id }} but it does not" end else - fail "Could not parse {{a.id}} or {{b.id}}" + fail "Could not parse {{ a.id }} or {{ b.id }}" end end end macro expect_not_equal(a, b) - it "{{a.id}} vs {{b.id}}" do - node1 = Parser.parse({{a}}) - node2 = Parser.parse({{b}}) + it "{{ a.id }} vs {{ b.id }}" do + node1 = Parser.parse({{ a }}) + node2 = Parser.parse({{ b }}) if node1 && node2 result = Mint::TypeChecker::Comparer.compare(node1, node2) if result - fail "Expected {{a.id}} not to equal to {{b.id}} but the result is #{result.to_s}" + fail "Expected {{ a.id }} not to equal to {{ b.id }} but the result is #{result.to_s}" end else - fail "Could not parse {{a.id}} or {{b.id}}" + fail "Could not parse {{ a.id }} or {{ b.id }}" end end end @@ -142,14 +142,14 @@ describe Mint::TypeChecker do recordb = Record.new("Blah", {"name" => Type.new("B")} of String => Checkable) Mint::TypeChecker::Comparer.compare(recorda, recorda).should be_a(Record) - Mint::TypeChecker::Comparer.compare(recordb, recorda).should eq(nil) + Mint::TypeChecker::Comparer.compare(recordb, recorda).should be_nil end end describe "Record vs Type" do it "returns null for different name" do - Mint::TypeChecker::Comparer.compare(Record.new("Blah"), Type.new("Blaha")).should eq(nil) - Mint::TypeChecker::Comparer.compare(Type.new("Blah"), Record.new("Blaha")).should eq(nil) + Mint::TypeChecker::Comparer.compare(Record.new("Blah"), Type.new("Blaha")).should be_nil + Mint::TypeChecker::Comparer.compare(Type.new("Blah"), Record.new("Blaha")).should be_nil end it "returns null record for same name" do diff --git a/spec/utils/markd_vdom_renderer_spec.cr b/spec/utils/markd_vdom_renderer_spec.cr index 805d6dae5..8e2fb609b 100644 --- a/spec/utils/markd_vdom_renderer_spec.cr +++ b/spec/utils/markd_vdom_renderer_spec.cr @@ -3,16 +3,15 @@ require "../spec_helper" module Mint class Compiler describe VDOMRenderer do - html_block = - <<-HTML -| - hi - | -
| + hi + | +
tag if all the list - # items have only one paragraph (that what "thight" is). + # items have only one paragraph (that's what "tight" is). next if (grand_parent = node.parent?.try &.parent?) && node.type == Markd::Node::Type::Paragraph && grand_parent.type.list? && diff --git a/src/utils/terminal_snippet.cr b/src/utils/terminal_snippet.cr index 71e64972f..9894d3b3e 100644 --- a/src/utils/terminal_snippet.cr +++ b/src/utils/terminal_snippet.cr @@ -128,7 +128,7 @@ module Mint item.contents.each_char do |char| break unless char.ascii_whitespace? count += 1 - end || 0 + end count end @@ -149,7 +149,7 @@ module Mint item.contents.each_char do |char| break unless char.ascii_whitespace? count += 1 - end || 0 + end count end diff --git a/src/utils/watcher.cr b/src/utils/watcher.cr index 49077ae39..383b32feb 100644 --- a/src/utils/watcher.cr +++ b/src/utils/watcher.cr @@ -1,5 +1,5 @@ module Mint - # A class for detecting changes to a set of sepcific files (sepcifically + # A class for detecting changes to a set of specific files (specifically # `*.mint`, `.env` and `mint.json`). class Watcher @patterns : Array(String) = [] of String diff --git a/src/workspace.cr b/src/workspace.cr index 0352347f0..4d0e6c884 100644 --- a/src/workspace.cr +++ b/src/workspace.cr @@ -8,7 +8,7 @@ module Mint # class Workspace # The current artifacts of the program or the current error. - getter result : TypeChecker | Error = Error.new(:unitialized_workspace) + getter result : TypeChecker | Error = Error.new(:uninitialized_workspace) # Stores the AST (or error) of the file at the given path. @cache : Hash(String, Ast | Error) = {} of String => Ast | Error