Commit Graph
2003 Commits
Author SHA1 Message Date
eksperimental ed5671b4f8 Standardize use of backticks and quotes; including Error messages and Title Case commands
This is a large commit that does the following:
* Removes backticks from messages and comments.
  All references to backticks have been replaced with double quotes everywhere the
  code is not interpreted as Markdown, (ie. anywhere outside documentation and
  markdown files, such as in code comments, or error messages).

* Variables in Exception messages are printed using `inspect`
  The way no-matching error message are printed, have changed because now we use inspect for printing
  variables. The following file and their respective test have been changed:
  - lib/elixir/lib/exception.ex
  - lib/elixir/lib/inspect/algebra.ex
  - lib/elixir/test/elixir/inspect_test.exs
  - lib/ex_unit/test/ex_unit/formatter_test.exs
  - lib/elixir/test/elixir/exception_test.exs

* Properly use Title Case for Mix, Git, Dializer

* Use backticks when citing a command

****************************************************
CONVENTION FOR RENAMING USING BACKTICKS AND QUOTES

https://github.com/elixir-lang/elixir/pull/3697#issuecomment-138811747

1. Backticks should never be printed in error messages, neither be included anywhere where Markdown code is not interpreted as such.

2. Do not use single quotes anywhere. We should favor double quotes everywhere, to avoid confusion

3. If you want to format something in error messages, use inspect. For example, if you want to show the dependency name and that is an atom, instead of the dependency "foo", let's show the dependency :foo. Less noise and may click better

4. Similarly, if you want to show something with double quotes, call inspect, as it handles escaping as well as the quotes

5. Things like "--all" just add verbosity, we can definitely read --all without ambiguity.

6. When using switches with a single hyphen (such as "-o"), we can make it explicit in the text: e.g. "... give the switch -o when choosing ..."

****************************************************
SHELL COMMANDS TO DETECT CODE BREAKING THE RULES

* Detect values surrounded by single-quotes where we want double-quotes.

    # regular variables
    ag "'#{"
    # constants or ENV variables
    ag "'[A-Z][A-Z0-9_-]+"
    # switches
    ag -i "(?<!(\[))'--?[a-z0-9][a-z0-9_-]+'"
    # atoms
    ag -i "(?<!(\[))':[a-z0-9][a-z0-9_-]+'"

    # DETECT BACKTICKS OUTSIDE DOCS
    ag "^\s+(?<!(#))#[^#\r\n]*\`" --ignore "*.md"
    ag '^\s+["%].*`' --ignore "*.md"
    ag -s '(raise|Error)\b(?!(`|/)).*\`'

* Spot mentions to running a command that is not using backticks:

    commands="elixir|elixirc|mix|iex|ex_doc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    actions="runs?|running|executes?|executing|types?|typing|enters?|entering|calls?|calling"
    ag '(?i)('${actions}')(?-i)\b[^`\r\n/]+[\ \t]+(?!(`))('${commands}')'
    ag '(?-i)\b(?!(`))('${commands}')[\ \t]+[^`\r\n/]+(?i)(commands?)'

* Spot where a command is mentioned:

    #commands="erlang|elixir|eex|iex|ex_unit|ex_doc|logger|elixirc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    commands="mix|elixirc|git|make|rebar|dialyzer|erl|rm|cd|mkdir|rmdir|ln|ls|pwd"
    ag -s '(?<!(\`))(?<!(\.))(?<!(/))(?<!(:))(?<!(_))\b('${commands}')\b(?!(:))(?!(\?))(?!(_))(?!(-))(?!(\.))(?!(\`))(?!(/))(?!(>))' \
    --ignore "*.erl" --ignore "*.yrl" --ignore "*.src"
2015-09-11 18:49:51 +07:00
José Valim f6a681c3eb Ensure binding() doesn't warn on underscored vars, closes #3708 2015-09-11 11:25:27 +02:00
eksperimental 7b2fa9192a Use Title Case and backticks for Erlang and Elixir applications
It includes Erlang, Elixir, ExUnit, ExDoc, Logger, IEx, elixirc

It leaves Mix for a different PR.

Command to spot these words:

    ag -s '(?<!(\`))(?<!(\.))(?<!(/))(?<!(:))(?<!(_))(erlang|elixir|eex|iex|ex_unit|ex_doc|logger|elixirc)(?!(:))(?!(\?))(?!(_))(?!(-))(?!(\.))(?!(\`))(?!(/))(?!(>))' \
    --ignore "*.erl" --ignore "*.yrl" --ignore "*.src"
2015-09-09 01:51:22 +07:00
eksperimental c79d63f7c1 Correct spaces in iex>
It also removes the comment with doble ##,
So we can validate faulty indentation in iex>, ...>, ##  with command:

    # only 0, 2, 6, 10 spaces is valid for iex>, ...>, ##
    ag "^(\ {1}|\ {3,5}|\ {7,9}|\ {11,100})(iex>|\.\.\.>|##)" --ignore "*.sh" --ignore "*.md" --ignore "lib/ex_unit/test/ex_unit/doc_test_test.exs"
2015-09-07 23:28:30 +07:00
José Valim 4bb4e916fd Convert remaining test :atom to strings 2015-09-05 20:35:26 +02:00
aforward 5d7a7ec7f9 Add support for File.rename (unix-like mv) based on elrang specs 2015-09-05 08:09:13 -04:00
José Valim 7e27cbbe1d Properly convert captures in Macro.to_string/1 2015-09-04 13:35:35 +02:00
José Valim 3d316c13d7 Update b/1 helper for callback docs 2015-09-04 13:20:08 +02:00
José Valim f268a3d7b3 Add Stream.transform/4 2015-09-01 12:37:23 +02:00
José Valim 25f451ec16 Ensure we don't warn on missing imports if nothing was imported
Closes #3625
2015-09-01 10:29:54 +02:00
José Valim c838bcd3cb Improve unexpected token error messages 2015-09-01 00:32:46 +02:00
José Valim ab00a502bc Forward all info values to get_module_info 2015-08-31 21:03:52 +02:00
José Valim d0388f15db Add URI.to_string/1
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
2015-08-27 14:25:38 +02:00
Aleksei Magusev 9aee6f4452 Correct formatting 2015-08-25 15:43:24 +02:00
Gary Rennie c53da7ae12 fix(Kernel): check arguments on if and unless
`Kernel.if` and `Kernel.unless` are now only valid if there is exactly
one `do` key and optionally an `else` key.

Any calls to the if macro that do not satisfy these conditions raise an
ArgumentError with a relevant error message.

This closes #3614
2015-08-25 08:38:28 +01:00
José Valim 1a7412502f Also store lines in typedoc and ensure @*doc return strings 2015-08-24 13:28:48 +02:00
Dan Rees-Jones 5bb9c80dfb (#3603) add more application functions 2015-08-21 15:24:51 +01:00
Eric Entin 436cb8af38 update error messages, handle non-call first arg to ::: 2015-08-19 10:29:25 -04:00
Eric Entin f4edfd3dbb Improve error message when no return value specified in func spec 2015-08-19 09:48:42 -04:00
ꗈ ꘐ ꗈ b8ee8c3e73 Raise if heredic terminator in invalid location
issue #3503

This will raise:
```elixir
foo = """
this """
```

This will not:
```elixir
foo = """
this \"\"\"
"""
```
2015-08-17 12:08:38 -07:00
José Valim 7f12618827 Do not add fetch to access 2015-08-17 14:46:31 +02:00
José Valim c2813ac1ea Also perform new line checking with structs 2015-08-16 20:47:53 +02:00
José Valim 970f84382b Allow operators to work still after comments
Closes #3316
2015-08-16 20:11:11 +02:00
José Valim 3327854653 Support \u in strings and char lists for unicode mapping 2015-08-16 18:32:29 +02:00
José Valim 84830d37ef Deprecate ?\x in favor of simply 0x 2015-08-16 18:00:10 +02:00
José Valim aa43f3f281 Emit syntax error for invalid fn end, closes #3311 2015-08-16 15:30:20 +02:00
eksperimental 0a185f880b Fix warning in warning_test.exs
This was the warning:
> test/elixir/kernel/warning_test.exs:55: warning: variable message is unused
2015-08-16 00:21:29 +07:00
José Valim 600c3da3f3 Fix test name related failure 2015-08-15 14:48:30 +02:00
José Valim 6e217af205 Convert test :atom into test string 2015-08-15 14:41:46 +02:00
José Valim 27ec972023 Remove usage of use Behaviour 2015-08-14 23:02:20 +02:00
José Valim ac5c72dbc7 Soft-deprecate Behaviour 2015-08-14 23:01:37 +02:00
Eric Entin 7aba0e0b52 @callback can now be used directly (without Behaviour). Add @macrocallback. 2015-08-14 14:29:34 +01:00
James Fish 030a4fec31 Warn defaults not defined in function head with multiple clauses 2015-08-12 23:41:38 +01:00
James Fish ff3c641add Add GenServer.whereis/1 2015-08-12 17:11:30 +01:00
James Fish 84e3b895c1 Support custom tasks using monitor of registered process 2015-08-12 11:22:12 +01:00
James Fish ab809cf7bb Always unlink when shutting down task 2015-08-12 11:13:52 +01:00
James Fish 0a8324597a Allow nil pid in task 2015-08-12 11:13:52 +01:00
José Valim dcf6da28d7 Remove warnings from erlang suite 2015-08-12 11:46:32 +02:00
José Valim aeea7799fa Use or in left in [a, b, c] as the compiler can opt it better 2015-08-12 11:46:32 +02:00
ꗈ ꘐ ꗈ add22f4b5b capture non-symbolic operators (&and/2, &not/1, &c.)
partial fix for issue #3486
pin operator  is a different issue and will take some more investgation to find the cause.
2015-08-11 11:25:26 -07:00
José Valim ed0aa20010 Fix var warnings 2015-08-11 19:05:57 +02:00
José Valim a887d84d8f Add useless building warnings for module attributes and variables 2015-08-11 15:41:36 +02:00
José Valim 859d176037 Warn when numbers or binaries are not used within a block 2015-08-11 15:41:36 +02:00
James Fish 5284d17bc2 Set Agent initial call 2015-08-11 11:19:14 +01:00
José Valim ebff46615c Add @type struct and error when overriding builtins
Closes #2990
2015-08-11 11:44:24 +02:00
José Valim 683201fa4c Improve coverage for dynamic in clauses 2015-08-11 11:30:53 +02:00
José Valim b205b0605b Restrict ranges to work only with integers
Closes #2912
2015-08-11 10:30:07 +02:00
José Valim 80e51e0e60 Inline map operations in put_in and update_in 2015-08-10 18:06:27 +02:00
José Valim af7c09e0c1 Access is no longer a protocol 2015-08-10 17:40:53 +02:00
jisaacstone 58bc3a3c36 Raise if piping into binary operator with 2 args
Github issue #3483
Simple enough - added a clause to the `pipe` function that matches a binary operator with 2 arguments and raises an error
2015-08-09 23:20:30 -07:00