Commit Graph

51 Commits

Author SHA1 Message Date
Thad House
1f59ff72f9 [wpilib] Add ADIS IMUs (#3777)
Co-authored-by: Tyler Veness <calcmogul@gmail.com>
Co-authored-by: Matteo Kimura <mateus.sakata@gmail.com>
2021-12-30 19:43:53 -08:00
Tyler Veness
7269a170fb Upgrade maven deps to latest versions and fix new linter errors (#3772)
This also makes the Gradle build work with JDK 17.

The extra JVM args in gradle.properties works around a bug with spotless
and JDK 17: https://github.com/diffplug/spotless/issues/834

PMD.CloseResource was ignored because it's almost always a false
positive, and there are many of them.
2021-12-09 12:20:08 -08:00
Prateek Machiraju
d81ef2bc5c [wpilib] Fix deadlocks in Mechanism2d et al. (#3770)
UpdateEntries() and Flush() are called from methods that lock the mutex,
so locking it again will cause deadlocks. This also updates the Java
code to make MechanismObject2d::update synchronized like in the C++
version.
2021-12-06 14:42:02 -08:00
Tyler Veness
95dd20a151 [build] Enable spotbugs (#3601)
Benign spotbugs warnings were suppressed, and all others were fixed. Bug
descriptions are documented here:
https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2021-09-24 16:04:02 -07:00
Tyler Veness
c1e128bd5a Disable frivolous PMD warnings and enable PMD in ntcore (#3419)
Some valid warnings like throwing NullPointerException or using a for
loop instead of System.arraycopy() were fixed.

Abstract classes marked with PMD.AbstractClassWithoutAbstractMethod were
made concrete because they already had protected constructors.

Fixes #1697.
2021-06-09 07:01:00 -07:00
Peter Johnson
9c3b51ca0f [wpilib] Document simulation APIs (#3079)
- Remove sim checkstyle suppression
- Add [[nodiscard]] to C++ register callback functions
- Add a couple of missing sim functions

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Starlight220 <yotamshlomi@gmail.com>
2021-01-11 21:55:45 -08:00
Austin Shalit
65b2359b27 [build] Add spotless for other files (#3007)
Adds spotless formatting for Gradle, xml, md, and gitignore files.

yml linting is not performed as it requires a dependency on npm.
2020-12-30 16:17:20 -08:00
Peter Johnson
a751fa22d2 [build] Apply spotless for java formatting (#1768)
Update checkstyle config to be compatible with spotless.

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2020-12-29 22:45:16 -08:00
Austin Shalit
6e1919414e [build] Bring naming checkstyle rules up to date with Google Style guide (#1781)
Also update Checkstyle to 8.38.

Google changed their style guide from the last time we imported it. This PR brings in those naming changes. The change they made is allowing single letter member, parameter, and local variable names. They also added a lambda naming scheme and I thought it would be good to bring that in too.
2020-12-29 09:27:48 -08:00
Austin Shalit
6e7c7374fd [build] Globally Exclude PMD.TooManyMethods (#2793)
This was not a useful check, as every time we hit it, we simply excluded it.
2020-10-22 20:53:48 -07:00
Thad House
3cbec411c7 [build] Add package declaration check to checkstyle (#2446)
Co-authored-by: Austin Shalit <austinshalit@gmail.com>
2020-06-26 11:10:34 -07:00
Austin Shalit
4ebae17123 Enforce leading/trailing zeros in Java numeric constants (#2105)
Enforce that integer literals must not have leading zeros and that floating point literals must have leading or trailing zeros in Java.
2019-11-20 20:13:15 -08:00
Thad House
e716c36b89 Fix Nat.java generation to be incremental (#1831)
Also generate the imports.
2019-08-20 21:03:44 -07:00
Thad House
b9fa3a4398 Update to 2019 RoboRIO and 2019 v4 image (#1352)
Also make updates for Java 11:
* Disable errorprone plugin (currently broken on Java 11)
* Update checkstyle to 8.12
* Update pmd to 6.7.0
2018-10-07 18:11:57 -07:00
PJ Reiniger
488ba79379 Add more checkstyle checks to simulator code (#1289) 2018-08-23 23:15:29 -07:00
Austin Shalit
a11fcb605d Add UseConcurrentHashMap exception to PMD and clean NOPMDs (#1243) 2018-07-29 09:29:32 -07:00
Austin Shalit
9108a93598 Switch non-integration tests to JUnit 5 (#1120) 2018-06-11 15:01:49 -07:00
Austin Shalit
e548a5f705 Update and enable PMD 6.3.0 (#1107) 2018-06-03 10:00:53 -07:00
Austin Shalit
40cc743cc7 Enable checkstyle on cscore, ntcore, wpiutil (#1032)
Also update to version 8.10.
2018-05-24 00:31:04 -04:00
Austin Shalit
2e0709f05b Add spotless to check line endings (#1055) 2018-05-16 19:47:35 -07:00
Tyler Veness
d8c8643b52 Format HTML and XML files (#944)
Generated by wpilibsuite/styleguide#52.
2018-05-15 23:58:20 -07:00
Tyler Veness
6729a7d6b1 Run wpiformat on merged repo (#1021) 2018-05-13 17:09:56 -07:00
Austin Shalit
2fc60680f4 Remove RedundantModifiers (#578) 2017-10-17 21:47:55 -07:00
Austin Shalit
66002d6cac [WIP] Move examples to allwpilib (Java) (#569)
* Move examples to allwpilib

* Add checkstyle config to examples project

* Ran wpiformat

* Run checkstyle on examples

* Change maximum line length for examples to 80 chars

This number was chosen based on testing of the number of characters shown by default in Eclipse done by @Kevin-OConnor: 51 chars by default on an E09 @ 1024x600 (which has the welcome window open on the right), 71 with welcome closed, 95 with the right-hand outline pane closed

* Add mavenCentral repository

* Rename subproject & error on deprecated API use

* Remove deprecated API usage
2017-10-16 22:30:21 -07:00
Austin Shalit
ddd5aeba19 Checkstyle 8.1 (#584)
Added a few checks too:
- SimplifyBooleanExpression
- SimplifyBooleanReturn
- StringLiteralEquality
- UnnecessaryParentheses
2017-07-28 22:24:05 -07:00
Austin Shalit
74df3fac4e Require non null (#580)
* Replace null checks with Objects.requireNonNull()

* Use PMD rule instead of checkstyle rule
2017-07-18 20:32:08 -07:00
Austin Shalit
7187e005d4 Add Checkstyle WhitespaceAfter check (#466) 2017-05-06 23:22:16 -07:00
Austin Shalit
8f67f2c24c Remove unused code and add pmd check (#395) 2016-12-23 13:20:13 -06:00
Tyler Veness
d0900626da Removed format.py shim (#393)
Now that our formatter is a Python package (wpiformat), the format.py shim for invoking it is no longer necessary. styleguide#29 should be merged before this patch.
2016-12-18 19:46:20 -08:00
Austin Shalit
a705eb1c61 Add PMD and solve issues (#389) 2016-12-07 21:24:44 -08:00
Austin Shalit
c30057e923 Remove unused imports (#387) 2016-12-05 21:36:52 -08:00
Thad House
60e199b0bd Fixes format.py on windows (#293) 2016-10-24 22:17:02 -07:00
Tyler Veness
fdebdd520a Added format.py to Travis config (#236) 2016-10-23 21:37:43 -07:00
Tyler Veness
fd52912d74 Fixed return value propagation of format.py (#251) 2016-10-02 08:10:22 -07:00
Tyler Veness
32c95fa0da Moved style guide documents and scripts to wpilibsuite/styleguide (#207) 2016-08-21 10:31:43 -07:00
Tyler Veness
227fdc1a60 Updated C++ style guide (#196)
include guard section now requires #pragma once, enumerators now exclusively use constant naming, and a mention of format.py was added to the "Formatting" section and CONTRIBUTING.md.
2016-08-12 07:14:49 -07:00
Tyler Veness
3819cd0768 Updated cpplint.py and fixed its regexes for C-style casts (#193)
Additional C-style cast warnings thrown were also fixed.
2016-08-11 23:38:45 -07:00
Tyler Veness
e8f1fdda44 format.py now emits warnings for modified generated files (#195) 2016-08-11 23:10:10 -07:00
Tyler Veness
6251697f60 Added Lint task and parallelized format.py (#161) 2016-07-12 21:59:09 -07:00
Tyler Veness
aafca4ed7f Reduced duplication between formatting scripts with Task base class (#80)
Also added scripts for EOF newline management and for removing trailing whitespace. configure.bat was rewritten to use CRLF line endings. Documentation for the existing scripts was also improved.
2016-07-10 08:33:27 -07:00
Tyler Veness
c7c011813f Made include ordering/organization more explicit in style guide (#86) 2016-05-31 23:46:44 -07:00
Tyler Veness
62812faf62 Clean up include guards and EOF newlines (#65)
* Replaced include guards with #pragma once

* All source files now have exactly one newline appended

Some files had either two newlines at the end or none (which isn't POSIX compliant). This patch fixes that.
2016-05-25 22:40:15 -07:00
Peter Johnson
e63830ed21 format.py: Fix running from styleguide directory on Windows. (#55) 2016-05-24 22:33:13 -07:00
Peter Johnson
eb51de65e5 format.py: Error out if no files found to format. (#56)
This can happen if the script is run from a directory other than the
project root or styleguide.
2016-05-24 22:16:53 -07:00
Tyler Veness
248ca0c4a0 Added verbose flag to format.py (#47)
Making the "Processing" lines only print with a verbose option keeps the output clean.
2016-05-22 21:40:30 -07:00
Tyler Veness
e14e45da76 Add format script which invokes clang-format on the C++ source code (#41)
On Windows machines, clang-format.exe must be in the PATH environment variable.
2016-05-20 17:30:37 -07:00
Jonathan Leitschuh
a834fff7b2 Applies Google Styleguide to Java parts of the library (#23)
This was partially applied to simulation but
simulation is a bit of a mess and has a lot of duplicated code.
2016-05-20 09:07:40 -07:00
Fredric Silberberg
5bc6e1378c Readded styleguide accidentally removed in the reorg
Change-Id: I240516c2c62d056e6ea4c31026918f5414c6a710
2016-01-01 19:32:33 -08:00
Fredric Silberberg
6d854afb0e WPILib Reorganization
This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.

The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.

Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
2015-11-21 18:26:49 -05:00
James Kuszmaul
1c3882ec72 Create a WPILib Style guide.
This commit is intended to be used a place
to start work on getting the styleguides which
we would like to use for WPILib up to date in
some useful format.

This particular commit need not be merged immediately
and people who wish to contribute to/have suggestions
for the style guide can either comment on this
or make commits based on this with their
suggestions.

The changes in this commit itself are relatively minimal,
just adding reminders that the style guides are
works in progress.

The main things which we need to do to get the style
guides useful are:
-Making formatting rules clear/easy to follow. For
  instance, I do not believe that the original guides
  linked straight to the eclipse format configuration
  files, even though they are quite useful.
-Adding in some WPILib specific stuff and information
  about how best to work on the code in our environment.
-Removing any guidelines which we don't want or don't need.
-Making the style guide readable/accessable enough that
  we can actually expect people to use/read it.
-Determining how/to what degree we want to enforce the
  strictures in the style guide.
-Determining how to handle our pre-existing code to
  either update it outright or to grandfather it in.
-Any other things to do which I may have forgotten
  while writing this commit message.

Change-Id: Ia6ea131e7d81d8c77a0487c8da17c0b264590e06
2015-07-01 15:44:17 -04:00