From 5fdf71ddc608fd706c6f8981316e258f949f707a Mon Sep 17 00:00:00 2001 From: Gabriel Gonzalez Date: Fri, 11 Sep 2015 18:59:02 -0600 Subject: [PATCH] Add `--verbose` and `--quiet` options to `compile.scalastyle` This adds new `--verbose` and `--quiet` options to the `compile.scalastyle` goal, which get threaded directly to scalastyle, as requested in issue #1888. Note: `scalastyle` currently accepts but ignores the `--verbose` option (See: https://github.com/scalastyle/scalastyle/issues/159). However, I include it anyway for when that issue is eventually fixed. Testing Done: $ ./pants test tests/python/pants_test/tasks:scalastyle_integration # Newly added integration test passes $ ./pants test tests/python/pants_test:all # Unit tests pass I'm relying on Travis for the remaining integration tests Bugs closed: 2172 Reviewed at https://rbcommons.com/s/twitter/r/2799/ --- .../org/pantsbuild/example/styleissue/BUILD | 6 ++++++ .../example/styleissue/StyleIssue.scala | 8 ++++++++ .../pantsbuild/example/styleissue/style.xml | 3 +++ .../pants/backend/jvm/tasks/scalastyle.py | 16 +++++++++++++++- .../tasks/test_scalastyle_integration.py | 19 +++++++++++++++++++ 5 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 examples/src/scala/org/pantsbuild/example/styleissue/BUILD create mode 100644 examples/src/scala/org/pantsbuild/example/styleissue/StyleIssue.scala create mode 100644 examples/src/scala/org/pantsbuild/example/styleissue/style.xml diff --git a/examples/src/scala/org/pantsbuild/example/styleissue/BUILD b/examples/src/scala/org/pantsbuild/example/styleissue/BUILD new file mode 100644 index 00000000000..31787568836 --- /dev/null +++ b/examples/src/scala/org/pantsbuild/example/styleissue/BUILD @@ -0,0 +1,6 @@ +# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). +# Licensed under the Apache License, Version 2.0 (see LICENSE). + +scala_library(name = 'styleissue', + sources = ['StyleIssue.scala'], +) diff --git a/examples/src/scala/org/pantsbuild/example/styleissue/StyleIssue.scala b/examples/src/scala/org/pantsbuild/example/styleissue/StyleIssue.scala new file mode 100644 index 00000000000..2a5f336c75a --- /dev/null +++ b/examples/src/scala/org/pantsbuild/example/styleissue/StyleIssue.scala @@ -0,0 +1,8 @@ +// Copyright 2015 Pants project contributors (see CONTRIBUTORS.md). +// Licensed under the Apache License, Version 2.0 (see LICENSE). + +package org.pantsbuild.example.hello.styleissue; + +// A program designed to deliberately fail a scalastyle check + class StyleIssue { + } diff --git a/examples/src/scala/org/pantsbuild/example/styleissue/style.xml b/examples/src/scala/org/pantsbuild/example/styleissue/style.xml new file mode 100644 index 00000000000..707af9eea13 --- /dev/null +++ b/examples/src/scala/org/pantsbuild/example/styleissue/style.xml @@ -0,0 +1,3 @@ + + + diff --git a/src/python/pants/backend/jvm/tasks/scalastyle.py b/src/python/pants/backend/jvm/tasks/scalastyle.py index 3d82788ac05..6e0ccdd20ed 100644 --- a/src/python/pants/backend/jvm/tasks/scalastyle.py +++ b/src/python/pants/backend/jvm/tasks/scalastyle.py @@ -71,6 +71,10 @@ def register_options(cls, register): '(relative to the repo root) matches any of these regexes.') register('--jvm-options', action='append', metavar='