Skip to content

Commit

Permalink
build - Apply spotless license header checks to solidity sources (#7046)
Browse files Browse the repository at this point in the history
* build - Apply spotless license header checks to solidity sources

---------

Signed-off-by: Usman Saleem <[email protected]>
  • Loading branch information
usmansaleem authored May 3, 2024
1 parent 6728e09 commit 87afe64
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 12 deletions.
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/CrossContractReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ contract CrossContractReader {
CrossContractReader cross = CrossContractReader(crossAddress);
cross.destroy();
}
}
}
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/EventEmitter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ contract EventEmitter {
function sender() view public returns (address) {
return _sender;
}
}
}
4 changes: 2 additions & 2 deletions acceptance-tests/tests/contracts/RemoteSimpleStorage.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright contributors to Hyperledger Besu
* Copyright contributors to Hyperledger Besu.
*
* Licensed 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
Expand Down Expand Up @@ -34,4 +34,4 @@ contract RemoteSimpleStorage {
function get() public view returns (uint) {
return simpleStorage.get();
}
}
}
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/RevertReason.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ contract RevertReason {
function revertWithoutRevertReason() public pure returns (bool) {
revert();
}
}
}
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/SimpleStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ contract SimpleStorage {
function get() public view returns (uint) {
return data;
}
}
}
4 changes: 2 additions & 2 deletions acceptance-tests/tests/contracts/TestDepth.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright Hyperledger Besu Contributors.
* Copyright contributors to Hyperledger Besu.
*
* Licensed 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
Expand Down Expand Up @@ -29,4 +29,4 @@ contract TestDepth {
x = gasleft();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*
* SPDX-License-Identifier: Apache-2.0
*/

pragma solidity ^0.5.0;

contract Migrations {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright contributors to Hyperledger Besu.
*
* Licensed 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.4.0 <0.6.0;
// THIS CONTRACT IS FOR TESTING PURPOSES ONLY
// DO NOT USE THIS CONTRACT IN PRODUCTION APPLICATIONS
Expand Down Expand Up @@ -43,4 +57,4 @@ contract SimpleAccountPermissioning {
function getSize() public view returns(uint256) {
return size;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright contributors to Hyperledger Besu.
*
* Licensed 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.4.0 <0.6.0;
// THIS CONTRACT IS FOR TESTING PURPOSES ONLY
// DO NOT USE THIS CONTRACT IN PRODUCTION APPLICATIONS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright contributors to Hyperledger Besu.
*
* Licensed 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.4.0 <0.6.0;
// THIS CONTRACT IS FOR TESTING PURPOSES ONLY
// DO NOT USE THIS CONTRACT IN PRODUCTION APPLICATIONS
Expand Down
11 changes: 10 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,16 @@ allprojects {
}
// Below this line are currently only license header tasks
format 'bash', { target '**/*.sh' }
format 'sol', { target '**/*.sol' }
format 'Solidity', {
target '**/*.sol'
targetExclude '**/src/reference-test/**', '**/src/main/generated/**', '**/src/test/generated/**', '**/src/jmh/generated/**'
trimTrailingWhitespace()
endWithNewline()

licenseHeaderFile("${rootDir}/gradle/spotless/java.former.license","^pragma solidity.+?").named("former").onlyIfContentMatches("^/\\*\\r?\\n.*Copyright ConsenSys AG\\.")
licenseHeaderFile("${rootDir}/gradle/spotless/java.former.date.license","^pragma solidity.+?").named("former.date").onlyIfContentMatches("^/\\*\\r?\\n.* Copyright \\d{4} ConsenSys AG\\.")
licenseHeaderFile("${rootDir}/gradle/spotless/java.current.license","^pragma solidity.+?").named("current").onlyIfContentMatches("^(?!/\\*\\r?\\n \\*.*ConsenSys AG\\.)")
}
}

tasks.withType(JavaCompile).configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ contract Validators {
return validators;
}

}
}

0 comments on commit 87afe64

Please sign in to comment.