You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@yetus.apache.org by GitBox <gi...@apache.org> on 2020/10/06 14:26:07 UTC

[GitHub] [yetus] busbey commented on a change in pull request #144: YETUS-1012. Major overhaul of precommit documentation

busbey commented on a change in pull request #144:
URL: https://github.com/apache/yetus/pull/144#discussion_r500304048



##########
File path: asf-site-src/config.rb
##########
@@ -158,14 +159,18 @@ def build_release_docs(output, version) # rubocop:disable Metrics/AbcSize, Metri
     end
   else
     puts "Downloading and extracting #{version} from ASF archives"
-    `(cd  #{output} \
+    `(pushd #{output} \
       && mkdir -p build-#{version} \
       && curl --fail --location --output site-#{version}.tar.gz \
         https://archive.apache.org/dist/yetus/#{version}/apache-yetus-#{version}-site.tar.gz \
       && tar -C build-#{version} \
          --strip-components 3 -xzpf site-#{version}.tar.gz \
         apache-yetus-#{version}-site/documentation/in-progress/ \
+      && popd

Review comment:
       if we're in a subshell why do we need a pushd/popd? just being rigorous?

##########
File path: asf-site-src/source/documentation/in-progress/precommit/index.html.md
##########
@@ -0,0 +1,164 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Basic Precommit
+
+<!-- MarkdownTOC levels="1,2,3" autolink="true" indent="  " bullets="*" bracket="round" -->
+
+* [Purpose](#purpose)
+* [Goals](#goals)
+* [Pre-requisites](#pre-requisites)
+  * [Base Requirements](#base-requirements)
+  * [Plug-ins](#plug-ins)
+    * [Bundled Plug-ins](#bundled-plug-ins)
+    * [Optional Plug-ins](#optional-plug-ins)
+* [More information](#more-information)
+
+<!-- /MarkdownTOC -->
+
+# Purpose
+
+Performing reviews can be an overwhelming process.  The more complex the base, the more comprehensive reviews end up.  Building that functionality into the build itself is a full time job.  Plus, if a new check is added, there is a good chance that the existing code has problems and just want to prevent new bits from making the existing problem worse.

Review comment:
       > Plus, if a new check is added, there is a good chance that the existing code has problems and just want to prevent new bits from
   
   When a new check is added there is a good chance the existing code has problems and often maintainers just want to prevent new bits from

##########
File path: asf-site-src/source/documentation/in-progress/precommit/index.html.md
##########
@@ -0,0 +1,164 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Basic Precommit
+
+<!-- MarkdownTOC levels="1,2,3" autolink="true" indent="  " bullets="*" bracket="round" -->
+
+* [Purpose](#purpose)
+* [Goals](#goals)
+* [Pre-requisites](#pre-requisites)
+  * [Base Requirements](#base-requirements)
+  * [Plug-ins](#plug-ins)
+    * [Bundled Plug-ins](#bundled-plug-ins)
+    * [Optional Plug-ins](#optional-plug-ins)
+* [More information](#more-information)
+
+<!-- /MarkdownTOC -->
+
+# Purpose
+
+Performing reviews can be an overwhelming process.  The more complex the base, the more comprehensive reviews end up.  Building that functionality into the build itself is a full time job.  Plus, if a new check is added, there is a good chance that the existing code has problems and just want to prevent new bits from making the existing problem worse.
+
+This is where Apache Yetus' precommit utilities come into the picture.
+
+All patches to the source base go through a test that does some (relatively) light checking to make sure the proposed change does not break unit tests and/or passes some other prerequisites such as code formatting guidelines.  This is meant as a preliminary check for reviewers so that the basic patch is in a known state and for contributors to know if they have followed the project's guidelines.  This check may also be used by individual developers to verify a patch prior to sending to the QA systems.
+
+# Goals
+
+* Everyone's time is valuable.  The quicker contributors can get feedback and iterate, the more likely and faster their contribution will get checked in.  A committer should be able to focus on the core issues of a contribution rather than details that can be determined automatically.
+* Checks should be fast.  There is no value in testing parts of the source tree that are not immediately impacted by a change.  Unit testing is the target. They are not a replacement for full builds or integration tests.
+* In many build systems (e.g., maven), a modular design has been picked.  This modularity should be exploited to reduce the amount of checks that need to be performed.
+* Projects that use the same language will, with a high degree of certainty, benefit from the same types of checks.
+* Portability matters.  Tooling should be as operating system and language agnostic as possible.
+
+# Pre-requisites
+
+Almost all of the precommit components are written in bash for maximum portability.  As such, it mostly assumes the locations of commands to be in the file path. However, in many cases, this assumption may be overridden via command line options.
+
+For Solaris and Solaris-like operating systems, the default location for the POSIX binaries is in `/usr/xpg4/bin` and the default location for the GNU binaries is `/usr/gnu/bin`.

Review comment:
       nit: this reads weird here. maybe better after the list of components?

##########
File path: asf-site-src/source/documentation/in-progress/precommit/plugins/nobuild.html.md
##########
@@ -0,0 +1,46 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Name
+
+nobuild
+
+# Category
+
+Build Tool
+
+# Description
+
+A stub build tool that does not do anything to enable just static linting.

Review comment:
       A stub build tool that does not do anything. Use this if you would like to enable static linting without getting Yetus to work with your project's build system.

##########
File path: asf-site-src/source/documentation/in-progress/precommit/plugins/golangcilint.html.md
##########
@@ -0,0 +1,53 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Name
+
+golangcilint
+
+# Category
+
+Test
+
+# Description
+
+NOTE: Go support is experimental.  Additionally, this plug-in only supports Go using Go modules.

Review comment:
       nit: I would love it if every use of "foo is experimental" included a call to action with a link to our "how to contribute" guide

##########
File path: asf-site-src/source/documentation/in-progress/precommit/plugins/findbugs.html.md
##########
@@ -0,0 +1,46 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Name
+
+findbugs
+
+# Category
+
+Test
+
+# Description
+
+Provides support for the [FindBugs](https://findbugs.sourceforge.net/) Java utility.

Review comment:
       nit: We should note in here somewhere that this plugin is deprecated in favor of using spotbugs directly?

##########
File path: asf-site-src/source/documentation/in-progress/precommit/plugins/pylint.html.md
##########
@@ -0,0 +1,53 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+# Name
+
+pylint
+
+# Category
+
+Test
+
+# Description
+
+Runs [pylint](http://pylint.org/) against PYthon code.
+
+# Environment Variables
+
+None
+
+# Options
+
+| Option | Notes |
+|:---------|:------|
+| `--pylint=<file>` | Location of the `pylint` binary if it is not on the path.  Default is 'pylint'. |
+| `--pylint-pip-cmd=<file>` | Location of the `pip` binary for install requirements.txt files.  Default is 'pip'. |
+| `--pylint-rcfile=<file>` | Location of the `.pylintrc` file to override `pylint` default. |
+| `--pylint-requirements=<bool>` | Process any `requirements.txt` file.  Default is 'false'. |
+| `--pylint-use-user=<bool>` | Use `--user` for processing the `requirements.txt` file.  Default is 'true'. |
+
+# Docker Notes
+
+The default Apache Yetus image comes with `pip2`/`pylint2` for Python 2.x support and `pip3`/`pylint3` for Python 3.x support.
+The `pip` and `pylint` point to the Python 3.x versions.

Review comment:
       follow-on: is it worth adding something like a `--pylint-python-2` shortcut for those that want to have these point at the python 2 version, given that we already have the bits installed? or  better to have docs give an example of using the `--pylint` and `--pylint-pip-cmd` args to do it?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org