Skip to content

Commit

Permalink
chore: CheckStyle checks copyright notice header (#1197)
Browse files Browse the repository at this point in the history
* chore: test copyright notice with Checkstyle

CheckStyle has a directive RegexpHeader since checkstyle version 6.9.
We can use it for check copyright notice in source header

Signed-off-by: Hiroshi Miura <[email protected]>

* style: fix copyright header

Signed-off-by: Hiroshi Miura <[email protected]>

* fix: remove CopyrightTest.java in aligner

Signed-off-by: Hiroshi Miura <[email protected]>

* fix: remove CopyrightTest.java in theme module

Signed-off-by: Hiroshi Miura <[email protected]>

* style: copyright headers in tests

Signed-off-by: Hiroshi Miura <[email protected]>

---------

Signed-off-by: Hiroshi Miura <[email protected]>
  • Loading branch information
miurahr authored Nov 24, 2024
1 parent e383b05 commit 4a568b0
Show file tree
Hide file tree
Showing 99 changed files with 193 additions and 1,230 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
*
* OmegaT - Computer Assisted Translation (CAT) tool
* with fuzzy matching, translation memory, keyword search,
* glossaries, and translation leveraging into updated projects.
Expand Down
101 changes: 0 additions & 101 deletions aligner/src/test/java/org/omegat/gui/align/CopyrightTest.java

This file was deleted.

12 changes: 12 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@
<property name="file" value="${config_loc}/suppressions.xml"/>
</module>

<module name="RegexpHeader">
<property name="headerFile" value="${config_loc}/java.header"/>
<property name="multiLines" value="6"/>
<property name="fileExtensions" value="java"/>
</module>

<module name="RegexpHeader">
<property name="headerFile" value="${config_loc}/properties.header"/>
<property name="multiLines" value="6"/>
<property name="fileExtensions" value="properties"/>
</module>

<!-- Checks for Size Violations. -->
<!-- See https://checkstyle.org/checks/sizes/index.html -->
<module name="FileLength"/>
Expand Down
24 changes: 24 additions & 0 deletions config/checkstyle/java.header
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
^/\*(\*{73,})?$
OmegaT \- Computer Assisted Translation \(CAT\) tool$
with fuzzy matching, translation memory, keyword search,$
glossaries, and translation leveraging into updated projects.$
^( \*)?$
(Copyright \(C\)|\s{13}) \d\d\d\d((-|,)\d\d\d\d)? (\w+|\s|,)+
Home page: https://www.omegat.org/
Support center: https://omegat.org/support
^( \*)?$
This file is part of OmegaT.$
^( \*)?$
OmegaT is free software: you can redistribute it and/or modify$
it under the terms of the GNU General Public License as published by$
the Free Software Foundation, either version 3 of the License, or$
\(at your option\) any later version.$
^( \*)?$
OmegaT is distributed in the hope that it will be useful,$
but WITHOUT ANY WARRANTY; without even the implied warranty of$
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$
GNU General Public License for more details.$
^( \*)?$
You should have received a copy of the GNU General Public License$
along with this program. If not, see <https://www.gnu.org/licenses/>.$
^\s?(\*{73,})?\*/$
24 changes: 24 additions & 0 deletions config/checkstyle/properties.header
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
^#(/?\*{75,})?$
^# OmegaT \- Computer Assisted Translation \(CAT\) tool$
^# with fuzzy matching, translation memory, keyword search,$
^# glossaries, and translation leveraging into updated projects.$
^#$
^# (Copyright \(C\)|\s{13}) \d\d\d\d(-\d\d\d\d)? (\w+|\s|,)+
^# Home page: https://www.omegat.org/
^# Support center: https://omegat.org/support
^#$
^# This file is part of OmegaT.$
^#$
^# OmegaT is free software: you can redistribute it and/or modify$
^# it under the terms of the GNU General Public License as published by$
^# the Free Software Foundation, either version 3 of the License, or$
^# \(at your option\) any later version.$
^# ^( \*)?$
^# OmegaT is distributed in the hope that it will be useful,$
^# but WITHOUT ANY WARRANTY; without even the implied warranty of$
^# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$
^# GNU General Public License for more details.$
^#$
^# You should have received a copy of the GNU General Public License$
^# along with this program. If not, see <https://www.gnu.org/licenses/>.$
^#(\*{75,}/?)?$
5 changes: 4 additions & 1 deletion config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<suppressions>

<!-- Permanently suppress errors/warnings -->

<!-- ignore -->
<suppress files="gen.core.*+" checks="RegexpHeader"/>

<!-- tests -->
<suppress files="TestCore\.java" checks="MethodLength"/>
Expand Down Expand Up @@ -161,7 +164,7 @@
<suppress checks="(TypeName|MissingSwitchDefault)" files="srtFilter\.java" lines="55,102"/>
<suppress checks="TypeName" files="XLIFFOptions\.java" lines="67"/>
<suppress files="XHTMLDialect\.java" checks="InnerAssignment" lines="131,132"/>
<suppress files="CamtasiaWindowsDialect\.java" checks="MethodLength" lines="45"/>
<suppress files="CamtasiaWindowsDialect\.java" checks="MethodLength" lines="44"/>
<suppress files="Entry\.java" checks="MethodLength"/>
<suppress files="Handler\.java" checks="EmptyBlock" lines="857"/>

Expand Down
11 changes: 4 additions & 7 deletions doc_src/build.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
/**************************************************************************
OmegaT - Java based Computer Assisted Translation (CAT) tool
OmegaT - Computer Assisted Translation (CAT) tool
Copyright (C) 2011-2012 Didier Briel
2014-2015 Didier Briel
2019 Aaron Madlon-Kay
Home page: http://www.omegat.org/
Home page: https://www.omegat.org/
Support center: https://omegat.org/support
This file is part of OmegaT.
Expand All @@ -23,8 +21,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
**************************************************************************/
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
<project name="OmegaT documentation" default="all">

Expand Down

This file was deleted.

Loading

0 comments on commit 4a568b0

Please sign in to comment.