Commit Graph
4267 Commits
Author SHA1 Message Date
eksperimental e1bdac2cf2 Replace en-dash when it should be hyphen 2015-09-11 19:47:35 +07:00
eksperimental a624573757 Replace all occurrences of em-dashes in favour of hyphens 2015-09-11 19:47:24 +07:00
eksperimental 85c2342282 IO.ANSI: move away link from Summary
Put it at the beggining of the second paragraph and link with with
the article's title.
2015-09-11 19:28:49 +07:00
José Valim af15f91147 Merge pull request #3697 from eksperimental/corrections3
Use Title Case and backtick for: Mix, rebar, and others
2015-09-11 14:08:31 +02:00
eksperimental eca59aad17 Fix bugs involving Markdown code
Fix common mistakes like the random backtick hanging in the wrong place,
or the wrongly formatted link, or single-quotes instead of backtick.

Commands to detect these common mistakes:
        ## COMMON MISTAKES
        # single backtick in html docs
        ag '`' ./doc --ignore "*.css" --ignore "*.js"
        # links in the wrong format
        ag '\[\w+://[^)\] ]+\]'
        ag '\(\w+://[^)\] ]+\]'
        ag '\[\w+://[^)\] ]+\)'
        # find html code like: ["Strictly Pretty" (2000) by Christian Lindig][0]</p>
        ag '\[[^\]]+\](\(|\[)' doc/ --ignore "*.js"
2015-09-11 18:51:18 +07:00
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
eksperimental 3f8984bbb7 Inspect.Algebra: Move numbered link off the first line
This is because in the modules summary, [0] won't be intepreted as a link,

original reported: https://github.com/elixir-lang/ex_doc/issues/347
2015-09-11 18:12:40 +07:00
José Valim f6a681c3eb Ensure binding() doesn't warn on underscored vars, closes #3708 2015-09-11 11:25:27 +02:00
José Valim 12f89a30b4 Merge pull request #3704 from eksperimental/pin_operator
Mention the Pin Operator in its documentation
2015-09-10 14:55:22 +02:00
eksperimental cf6747c4f5 Mention the Pin Operator in its documentation 2015-09-10 19:41:49 +07:00
José Valim 4bea1ae628 Merge pull request #3700 from eksperimental/string_strip
String.*strip: mention that ALL leading/trailing `char`s will be removed
2015-09-10 11:55:31 +02:00
José Valim 5ef57375f1 Merge pull request #3701 from eksperimental/enum_default
Enum: renamed the rarely used `ifnone` argument, in favour of `default`
2015-09-10 11:55:04 +02:00
eksperimental 8b59aa823f Enum: renamed the rarely used ifnone argument, in favour of default 2015-09-10 09:53:49 +07:00
eksperimental 0c946b624c String: strip functions : mention that ALL leading/trailing chars will be removed 2015-09-09 23:40:22 +07:00
Gustavo Saiani b2790e9e48 Fix responsible to keep → responsible for keeping in env.ex doc 2015-09-09 08:42:37 -03:00
José Valim 8ca5758414 Merge pull request #3694 from eksperimental/corrections2
Use Title Case and backticks for Erlang and Elixir applications
2015-09-08 23:11:07 +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 f2074a9065 Correct descriptions in docs to use Present Continuous (2)
Corrects a few more cases that were not caught by the previous PR
https://github.com/elixir-lang/elixir/pull/3682

Command:

  ignore_words="a|an|the|in|exception|helper|callback|front-end|same|when|where|what|functionality|elixir|erlang|eex|iex|logger|environment|module|similar|\w+-like|opposite|boolean|current|information|basic|public|if|unless|otherwise|regular|internal|convenience|given|welcome to|shortcut to|writable|user|system|low-level|pipe operator|supervisor|administrator"
  ag "(@(module|short)?doc)\s+(~[Ss])?([\"']{3})(\r|\n|.)\s*+((?!((?i)${ignore_words}(?-i)))[\w'-]+)(?<!(s))(?<!(ed))(?<!(ity))(?<!(ally))(?<!(ily))(?<!(ely))(?=[\s\r\n,:.])"
2015-09-09 00:13:32 +07:00
José Valim 7dd1c9df5b Merge pull request #3691 from eksperimental/erlang_function_urls
Add text to all links
2015-09-08 19:00:51 +02:00
eksperimental 06d94f5b90 Add text to all links
This commits covers 100% of all links in the documentation,
using a words to describe what the page is about.

It users the `:module.function/arity` format for erlang functions that
link to the earlang docs.

I also changed some of the sentnces using the link from
- See [:erlang.function/2](http://...) for a list of available options.

to
- For a list of available options, see [:erlang.function/2](http://...)

The reasoning behind is that I think it's better to have an link at the end of the sentence
and not in the middle, so the reades doesn't need to finish the sentence to know what is it about and go back
and find the link. This way all the information is given before the link, so the users stops reading and can
click directly.
2015-09-08 23:16:14 +07:00
Gustavo Saiani f8602490ef Fix does → do verbal agreement in special_forms.ex 2015-09-08 12:25:51 -03:00
José Valim 4e4aa7a2c5 Provide a best practices section for use 2015-09-08 10:54:35 +02:00
José Valim 3c145b7f93 Merge pull request #3687 from eksperimental/correct_arity
Add/Correct arity in functions that are not being linked in html docs
2015-09-07 21:06:18 +02:00
eksperimental 8f0175fd98 Add arity or correct it for functions that are not being linked in the html docs
original issue: https://github.com/elixir-lang/ex_doc/issues/321

I created a shell script that checks for anything references to Modules that are not actually linked
http://git.io/check_not_linked_exdoc.sh

You can see the output here:
https://gist.github.com/eksperimental/6dc9bce36710a3c8b1d9

I will update the script to work with regular elixir projects, so it can be used by other projects
2015-09-08 01:47:15 +07:00
eksperimental a251ccc722 Format raise message consistently
Kernel.raise messages should not start with uppercase, and should not
have trailing punctuation.

Mix.raise messages should start with uppercase, and should not have a trailing
puntuation.

    # starting with uppercase
    # exclude (Mix.raise, and any message that starts with all uppecase such as: I or IO
    ag '(?<!Mix\.)raise\s+\"+(?!([A-Z]+\b))[A-Z]'

    # Mix.raise should start with upper case
    # except when `mix` or `rebar` are mentioned
    ag 'Mix\.raise\s+\"(?!(mix|rebar))+[a-z]'

    # ending in period
    ag "raise\s+\"+.+\.\"\s*\n"
2015-09-08 00:44:17 +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
eksperimental ef986d2a18 correct wording 2015-09-07 22:31:37 +07:00
eksperimental d629b540f9 Add backticks to true, false, nil
just an update to https://github.com/elixir-lang/elixir/pull/3207

Command to detect missing backticks:

    ag '^(?-m)[^\"\%\#\n]*\W(?m)(is|are|was|were|to|or|and|nor|when|returns?|defaults?|otherwise|\.)\s+(?-i)(true|false|nil)\W(?-m)'
2015-09-07 22:29:36 +07:00
José Valim 0572d8e82e Merge pull request #3682 from eksperimental/doc_verb_tense
Correct descriptions in docs to use Present Continuous
2015-09-07 13:58:07 +02:00
eksperimental 8d5c009b13 Correct descriptions in @doc, @moduledoc, @shortdoc to use Present Continuous
It makes it consistent with the rest of the docs.

I have just looked for the first line in @doc, @moduledoc, so lines bellow it may still need
to be corrected.

@shortdoc all have been corrected.

Inspired by: https://github.com/elixir-lang/elixir/pull/2942

Command to list the first lines:

```sh
  # first line in @moduledoc / @doc
  ag '(@(module)?doc)\s+("{3})(\r|\n|.)\s*+[\w-]+(?<!s)\b'

  # also @shortdoc
  ag '(@shortdoc)\s+("{1,3})(\r|\n|.)\s*+[\w-]+(?<!s)\b'
```
2015-09-07 18:40:58 +07:00
José Valim d4bc95e542 Merge pull request #3678 from eksperimental/indefinit_article
Correct indefinite article a/an
2015-09-07 13:29:08 +02:00
José Valim 2ae5959ae7 Merge pull request #3680 from eksperimental/unnamed_arguments
Regex.regex?/1: name unnamed argument and improve docs
2015-09-07 13:28:50 +02:00
eksperimental aeb3e82918 Correct indefinite article a/an
Run the following command, and reviewed the occurences one by one.

 # find words starting with vowels
 ag -i '\ban?\s+[aeiou]\w+\b'

 # find acronyms
 ag '\ban?\s+[BCDFGHJKLMNPQRSTVWXYZ][A-Z]+\b'

 # starting with "h"
 ag -i '\ban?\s+[aeiou]\w+\b'
2015-09-07 18:26:51 +07:00
eksperimental 3180d9f955 Regex.regex?/1: name unnamed argument and improve docs 2015-09-07 17:27:25 +07:00
eksperimental b8c032201b Correct double words
Also change some wording in process.ex
2015-09-07 17:25:26 +07:00
José Valim 4bb4e916fd Convert remaining test :atom to strings 2015-09-05 20:35:26 +02:00
José Valim 59cd1f169f Merge pull request #3673 from aforward/f/File.rename
F/file.rename
2015-09-05 20:35:15 +02:00
aforward 5d7a7ec7f9 Add support for File.rename (unix-like mv) based on elrang specs 2015-09-05 08:09:13 -04:00
aforward 6886994164 Fix typo in File.cp_r for files (rename tmp to b.txt) 2015-09-05 06:53:17 -04:00
José Valim 6cf1dcbfe4 Prune more elixir internals in stacktraces 2015-09-05 10:24:27 +02: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 ad869b8834 Merge pull request #3661 from fishcakez/gen_server_callbacks
Add and document GenServer/GenEvent callbacks
2015-09-04 10:55:17 +02:00
James Fish 86601650fe Add and document GenEvent callbacks 2015-09-04 00:34:22 +01:00
James Fish bf36c9d636 Improve Supervisor.start_link/2 spec 2015-09-04 00:06:33 +01:00
James Fish bd62f35745 Improve docs on GenServer.init/1 returning :ignore 2015-09-03 23:45:16 +01:00
James Fish f31c479e59 Add and document GenServer callbacks 2015-09-03 12:34:33 +01:00
Josh Adams 66fbae2480 Remove reference to GenServer.Behaviour from LocalsTracker 2015-09-01 19:29:19 -05:00
José Valim f268a3d7b3 Add Stream.transform/4 2015-09-01 12:37:23 +02:00
José Valim 9b34a31f96 Fix typespecs for Stream.chunk 2015-09-01 11:39:01 +02:00