Git Product home page Git Product logo

openwhisk-utilities's Introduction

Build Status License

OpenWhisk Utilities

Shared utilities used across Apache OpenWhisk project repositories.

Utility listing

The following utilities are included in this repository (by subdirectory):

  • scancode - Configurable code scanning utility that performs file and line-level checks on all files (exclusions permitted) on a provided path. It is intended for Git commit hooks and continuous integration (CI) builds to enforce certain coding conventions.

If you "push" code that follows all conventions, you will see the message:

Scanning files starting at [./mycodepath/]...
All checks passed.

However, if you push code containing tabs, trailing whitespace or missing Apache License headers, your build will fail immediately with one of the following messages:

Scan detected 3 error(s) in 1 file(s):
  [./mycodepath/sourcecode.go]:
       1: file does not include required license header.
      18: line contains tabs.
      27: line has trailing whitespaces.

To make sure this never happens to you, you can run the same tests on your local machine every time you commit changes.

  1. Clone the OpenWhisk utilities project:
$ git clone https://github.com/apache/openwhisk-utilities.git
  1. Run the scancode utility against the root directory of your project or subdirectory where your code changes live:
# Invoke Python utility (works with either Python 2 or 3)
$ python ./openwhisk-utilities/scancode/scanCode.py $ROOTDIR

It is worth adding a Git pre-commit hook to automatically run the checks before you can even type in a Git commit message. Here is a sample pre-commit file:

$ cat /path/to/openwhisk/.git/hooks/pre-commit
#!/usr/bin/env bash

# -- Code scanning --
# See https://github.com/apache/openwhisk-utilities
# determine openwhisk base directory
root="$(git rev-parse --show-toplevel)"
scancode_path="/path/to/openwhisk-utilities/scancode"
python $scancode_path/scanCode.py --config $scancode_path/ASF-Release.cfg --gitignore $root/.gitignore $root

Note: A hook a locally installed, so if you check out the repository again, you will need to reinstall it.

If your project repo. is new or does not run scancode yet, you can choose to create a "pre-build" Bash script that can be included in your Travis CI integration that includes code similar to Step 1 and 2. You can invoke this script within the ".travis.yml" file early in your install or build scripts.

Issues

Report bugs, ask questions and request features here on GitHub.

You can also join our Slack channel and chat with developers. To get access to our Slack channel, request an invite here.

openwhisk-utilities's People

Contributors

mrutkows avatar dgrove-oss avatar rabbah avatar jbampton avatar jonpspri avatar csantanapr avatar mhenke1 avatar akrabat avatar upgle avatar shawnallen85 avatar sven-lange-last avatar mcdan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.