Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into tabsize
Browse files Browse the repository at this point in the history
  • Loading branch information
specious committed Nov 16, 2017
2 parents 3d6aaff + d8e6435 commit b0d99a5
Show file tree
Hide file tree
Showing 379 changed files with 24,564 additions and 3,150 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*
!stack.yaml
!elm-format.cabal
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/dist/
/cabal.sandbox.config
/formatted.elm
/_input.elm
/_input2.elm
/.cabal-sandbox/
/_stdout.txt
*.tix
/.stack-work/
/tests/elm-format
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ before_install:
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
- stack --version


install:
Expand Down
71 changes: 71 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,74 @@
## master (0.7.1-beta)

Features promoted from 0.7.0-exp:
- Imports are now sorted and duplicate imports are merged
- `exposing` clauses in module headers are now sorted
- The body of `let` expressions are no longer indented
- Unnecessary parentheses are now removed (expect in binary operator expressions)

Bug fixes:
- Parentheses are not considered unnecessary if removing them would cause a comment to move to a different AST node
- Multiline `@docs` lines in markdown are now handled correctly

Syntax changes:
- Infix operator precedence and associativity declarations are now grouped together
- `if` expressions now have blank lines between clauses
- Comments immediately following `import`s now have spacing consistent with other top-level comments

Other changes:
- Removed support for Elm 0.16


## 0.7.0-exp

Experimental changes:
- Imports are now sorted and duplicate imports are merged
- `exposing` clauses in module headers are now sorted
- The body of `let` expressions are no longer indented
- Unnecessary parentheses are now removed

You can give feedback about experimental features at <https://goo.gl/forms/kLdTN1yikfOI8ZuA3>.

Bug fixes:
- Initial `@docs` lines in module documentation are now handled correctly
- Formatting for lambdas with multiline patterns is now implemented
- Code blocks in doc comments that immediately follow lists are now handled correctly

Other changes:
- elm-format now has a contributor code of conduct


## 0.6.1-alpha

- elm-format now formats your documentation comments:
- code snippets in your documentation will be elm-formatted
- markdown in your documentation will be normalized


## 0.6.0-alpha

Notes:
- Support for Elm 0.16 is deprecated (but is still available with the `--elm-version=0.16` option).

Syntax changes:
- Removed a workaround for an Elm 0.16 compiler bug that added extra parenthesis to qualified type tags in pattern matches
- End-of-line `--` comments are now kept on their original line when appropriate
- `--` comments in the middle of binary operator sequences no longer push the following expression to the next line
- `--` comments can be use to create sections in records and lists
- For Windows, CRLF newlines no longer corrupt literal strings

Bug fixes:
- Empty records containing multiline comments are now handled correctly
- Double quotes at the end of multiline strings are now handled correctly
- The `where` clause in `effect module`s are now required to have at least one field (and comments are now handled correctly)
- Record expressions with a trailing comma are no longer allowed (and comments are now handled correctly)
- Block comments containing only multiple lines of whitespace no longer crash elm-format

Other changes:
- `elm-format --validate` (meant for use in CI scripts) now reports errors as JSON
- When recursively searching a directory, `node_modules` folders are ignored


## 0.5.2-alpha

Bug fixes:
Expand Down
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# stack installation from https://github.com/samdoshi/docker-haskell-stack
FROM buildpack-deps:latest

ENV STACK_VERSION 1.4.0

ENV STACK_DOWNLOAD_URL https://github.com/commercialhaskell/stack/releases/download/v$STACK_VERSION/stack-$STACK_VERSION-linux-x86_64.tar.gz
ENV DEBIAN_FRONTEND noninteractive
ENV PATH $PATH:/root/.local/bin
ENV LANG C.UTF-8

RUN apt-get update -q && \
apt-get install -qy libgmp-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

RUN mkdir -p /root/.local/bin && \
wget -q -O- $STACK_DOWNLOAD_URL | tar --strip=1 -xvz -C /root/.local/bin/ && \
chmod +x /root/.local/bin/stack


# Install elm-format dependencies
COPY stack.yaml ./
RUN stack setup

COPY elm-format.cabal ./
RUN stack build --only-snapshot
RUN stack build --only-dependencies
RUN stack build --test --only-dependencies
5 changes: 4 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Copyright (c) 2015-2016, Aaron VonderHaar
Copyright (c) 2015-2017, Aaron VonderHaar
Copyright (c) 2012-2015, Evan Czaplicki (Elm parser forked from elm-lang/elm-compiler)
Copyright (c) 2015, Martin Janiczek
Copyright (c) 2015, Noah Hall
Copyright (c) 2016, Marica Odagaki
Copyright (c) 2016, Max Goldstein
Copyright (c) 2016, Daniel Bachler
Copyright (c) 2016, Fedor Nezhivoi
Copyright (c) 2013, John MacFarlane (Markdown parser forked from jgm/cheapskate)
Copyright (c) 2017, Michael Maloney

All rights reserved.

Expand Down
25 changes: 20 additions & 5 deletions PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,29 @@ brew cask install virtualbox

1. Create a github issue to draft the release notes.
1. Edit `elm-format.cabal` to remove `-dev` from the version and make sure the version number is correct.
1. Commit the change to `elm-format.cabal`.
1. Edit `CHANGELOG.md` to set the correct version number.
1. Update `ElmFormat.Version.experimental` to `Just <survey URL>` for experimental versions and `Nothing` otherwise.
1. `(cd package/npm && npm version "<new version>")`
1. Commit the changes "Bump version to *new version*"
1. Create a signed tag for the new version. `git tag -s <version> -m <version>`
1. Push the tag.
1. Wait for CI to successfully build the tag.


## Mac

1. Run `./package/mac/build-package.sh`


## Windows
## Linux

1. See `package/win/setup.md`
1. Make sure you have Docker installed and running
1. Run `./package/linux/build-in-docker.sh`


## Linux
## Windows

1. See `package/linux/setup.md`
1. See `package/win/setup.md`


## Publishing
Expand All @@ -49,6 +54,16 @@ brew cask install virtualbox
1. Update `README.md`


## NPM

```
cd package/npm
# for experimental releases
# npm publish --tag exp
npm publish
```


## Clean up

1. Edit `elm-format.cabal` with the next minor version number and add `-dev`.
Expand Down
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[![Build Status](https://travis-ci.org/avh4/elm-format.svg?branch=master)](https://travis-ci.org/avh4/elm-format)
![experimental](https://img.shields.io/badge/stability-experimental-orange.svg)
[![latest version: 0.5.2-alpha](https://img.shields.io/badge/version-0.5.2--alpha-blue.svg)](https://github.com/avh4/elm-format/releases/tag/0.5.2-alpha)
[![latest version: 0.7.0-exp](https://img.shields.io/badge/version-0.7.0--exp-orange.svg)](https://github.com/avh4/elm-format/releases/tag/0.7.0-exp)

# elm-format

Expand All @@ -15,6 +14,7 @@ The benefits of `elm-format`:
- It makes code **easier to read**, because there are no longer distracting minor stylistic differences between different code bases. As such, your brain can map more efficiently from source to mental model.
- It makes code **easier to maintain**, because you can no longer have diffs related only to formatting; every diff necessarily involves a material change.
- It **saves your team time** debating how to format things, because there is a standard tool that formats everything the same way.
- It **saves you time** because you don't have to nitpick over formatting details of your code.


## Usage
Expand All @@ -28,29 +28,30 @@ elm-format --stdin --output Main.elm # Format input from stdin and write to fil
elm-format --help # See other command line options
```

## Installation [![(latest version: 0.5.2-alpha)](https://img.shields.io/badge/version-0.5.2--alpha-blue.svg)](https://github.com/avh4/elm-format/releases/tag/0.5.2-alpha)

## Installation [![(latest version: 0.7.0-exp)](https://img.shields.io/badge/version-0.7.0--exp-orange.svg)](https://github.com/avh4/elm-format/releases/tag/0.7.0-exp)

> `elm-format` is still in alpha. If you run into any problems, please [report them](https://github.com/avh4/elm-format/issues).
>
> **The format produced by elm-format may change significantly before the 1.0.0 release.** If this will cause problems for you, please refrain from using elm-format during the alpha- and beta-test periods.
You will need to download the version appropriate for your OS, unzip it, and place `elm-format` or `elm-format.exe` (windows) on your `PATH`. Simpler installation options will be available once there is a stable release of elm-format.

If you need PGP signatures, see the [releases page](https://github.com/avh4/elm-format/releases).

### For Elm 0.18
### Experimental version

(To upgrade your Elm 0.17 project to Elm 0.18, see the [Elm 0.18 upgrade guide](https://github.com/elm-lang/elm-platform/blob/master/upgrade-docs/0.18.md).)
The latest version of `elm-format` contains experimental features that may or may not appear in future releases.
If you are able to some amount of instability on your Elm projects,
you can help with the development of `elm-format` by using the experimental version and providing feedback.
You can give feedback about the latest experimental version [here](https://goo.gl/forms/kLdTN1yikfOI8ZuA3).

- Mac: [download](https://github.com/avh4/elm-format/releases/download/0.5.2-alpha/elm-format-0.18-0.5.2-alpha-mac-x64.tgz)
- Linux: [download](https://github.com/avh4/elm-format/releases/download/0.5.2-alpha/elm-format-0.18-0.5.2-alpha-linux-x64.tgz)
- Windows: [download](https://github.com/avh4/elm-format/releases/download/0.5.2-alpha/elm-format-0.18-0.5.2-alpha-win-x64.zip)
To install the experimental version:

### For Elm 0.17
```sh
npm install -g elm-format@exp
```

- Mac: [download](https://github.com/avh4/elm-format/releases/download/0.5.2-alpha/elm-format-0.17-0.5.2-alpha-mac-x64.tgz)
- Linux: [download](https://github.com/avh4/elm-format/releases/download/0.5.2-alpha/elm-format-0.17-0.5.2-alpha-linux-x64.tgz)
- Windows: [download](https://github.com/avh4/elm-format/releases/download/0.5.2-alpha/elm-format-0.17-0.5.2-alpha-win-x64.zip)
or download the version appropriate for your OS from the [release page](https://github.com/avh4/elm-format/releases/tag/0.7.0-exp),
unzip it,
and place `elm-format` or `elm-format.exe` (windows) on your `PATH`.


## Editor integration
Expand Down Expand Up @@ -119,7 +120,7 @@ Find your editor in the table below. The recommended plugin for each editor is
<td>:trophy: <a href="https://marketplace.visualstudio.com/items?itemName=sbrink.elm">Elm Language Support</a></td>
<td>:warning: <a href="#visual-studio-code-installation">3 steps</a></td>
<td>❔ TBD</td>
<td>:x:</td>
<td>:warning: requires configuration</td>
<td>❔ TBD</td>
<td>❔ TBD</td>
</tr>
Expand Down Expand Up @@ -293,6 +294,8 @@ This is for WebStorm and other JetBrains IDEs.
## Development info
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
### Building from source
```bash
Expand Down
11 changes: 11 additions & 0 deletions Release Notes/0.1-alpha2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
> 0.1-alpha2 was [announced on the elm-dev mailing list](https://groups.google.com/forum/#!topic/elm-dev/lEzZLg6CvUI)
Hello all! Prompted by Richard and Evan a couple months ago, I (with help from [Martin](https://github.com/avh4/elm-format/commits?author=Janiczek) and [Noah](https://github.com/avh4/elm-format/commits?author=eeue56)) have been working on elm-format, a source code formatter for Elm inspired by [gofmt](https://blog.golang.org/go-fmt-your-code). There are still a few unhandled cases in the far reaches of the syntax space, but elm-format is now ready for use and feedback.

The goal for elm-format is to make it easy to follow a standard style for Elm code. The standard style is based on the [Elm Style Guide](http://elm-lang.org/docs/style-guide), which aims to be easy to read, produce clean diffs, and encourage well-factored code.

You can find the downloads and editor integration instructions here (this is the first time I've packaged binaries for multiple platforms, so if you have any problems running it, please let me know):
- https://github.com/avh4/elm-format
- https://github.com/avh4/elm-format#basic-usage

If you are excited about this kind of tool, please try it out and let me know if anything goes amiss! I have a few more bugs to fix before announcing it more publicly on elm-discuss, and I wanted to give you all a chance to look it over before then.
23 changes: 23 additions & 0 deletions Release Notes/0.2.0-alpha.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
> 0.2.0-alpha was [announced on the elm-dev mailing list](https://groups.google.com/d/topic/elm-dev/gR_1ClhZMg0/discussion)
After the tedious work of making the AST retain comments, elm-format-0.2-alpha is ready! Most notable is the switch to 2-space indentation, as [previously discussed on elm-dev](https://groups.google.com/d/topic/elm-dev/1fWxZPcQVqI/discussion). There are also now plugins for LightTable, Emacs, and Vim thanks to @rundis, @Bogdanp, and @ajhager!

You can find the downloads and editor integration instructions here:
- https://github.com/avh4/elm-format
- https://github.com/avh4/elm-format#basic-usage

Here's a brief list of changes:
- changed to 2-space indentation
- comments are handled everywhere they can appear
- fixed a unicode problem with console output on Windows
- parentheses in pattern matches are handled correctly, including a workaround for https://github.com/elm-lang/elm-compiler/issues/951
- triple double quotes in multiline strings are handled correctly
- more than one file or directory can be given on the command line
- added the `--stdin` command line option to support IDE plugins

Thanks to everyone who helped improve the documentation and to the following for contributing code to this release:
- Noah (@eeue56)
- Martin (@Janiczek)
- Marica (@ento)
- Janis (@jvoigtlaender)
- and to several others who helped improve the documentation
9 changes: 9 additions & 0 deletions Release Notes/0.3.0-alpha-elm017rc1-rc1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**You only want this if you are trying out the Elm-Platform-0.17 release candidate. If you are using Elm-0.16, you want [elm-format-0.2.0-alpha](https://github.com/avh4/elm-format/releases/tag/0.2.0-alpha) instead.**

> 0.3.0-alpha-elm017rc1-rc1 was a pre-0.3.0-alpha release that works with Elm-0.17-rc1 and was [announced on the elm-dev mailing list](https://groups.google.com/d/msg/elm-dev/M5Bk7yVCOHg/tewWr5YYBgAJ)
Regarding the new syntax for the `module` statement, this version of elm-format will automatically migrate 0.16 files to the 0.17 format.

Please report any 0.17-specific elm-format issues here to elm-dev, and not to the github issue tracker.

In addition, expect the next elm-format alpha release shortly after the public Elm 0.17 release.
Loading

0 comments on commit b0d99a5

Please sign in to comment.