Skip to content

Commit 74bc036

Browse files
fix: AutoPrettier changes not being pushed (#62)
* fix: AutoPrettier changes not being pushed * fix: CI issues (hopefully) * 🎨 Format Solidity code with Prettier Co-authored-by: autoprettier <[email protected]>
1 parent 0653099 commit 74bc036

27 files changed

+1261
-1415
lines changed

.github/workflows/autoprettier.yml

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
name: AutoPrettier
22

33
# Controls when the workflow will run
4-
on:
5-
# Triggers the workflow on push or pull request events but only for the main branch
6-
push:
7-
branches:
8-
- main
9-
pull_request:
10-
branches:
11-
- "*"
4+
on: [push, pull_request]
125

136
jobs:
147
autoprettier:
@@ -42,3 +35,4 @@ jobs:
4235
if: steps.git-check.outputs.modified == 'true'
4336
run: |
4437
git commit -am "🎨 Format Solidity code with Prettier"
38+
git push --force origin HEAD:$GITHUB_REF || true

package-lock.json

+4-172
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Maths/Abs.sol

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
3-
4-
/**
5-
* @title Get the absolute value of an integer.
6-
* @author [Perelyn](https://github.com/Perelyn-sama)
7-
* @dev https://www.khanacademy.org/math/cc-sixth-grade-math/cc-6th-negative-number-topic/cc-6th-absolute-value/v/absolute-value-of-integers
8-
*/
9-
contract Abs {
10-
/// Pass in a number and get it's absolute value
11-
function getAbs(int256 _n) public pure returns (int256 result) {
12-
if (_n < 0) {
13-
result = -(_n);
14-
} else {
15-
result = _n;
16-
}
17-
}
18-
}
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
/**
5+
* @title Get the absolute value of an integer.
6+
* @author [Perelyn](https://github.com/Perelyn-sama)
7+
* @dev https://www.khanacademy.org/math/cc-sixth-grade-math/cc-6th-negative-number-topic/cc-6th-absolute-value/v/absolute-value-of-integers
8+
*/
9+
contract Abs {
10+
/// Pass in a number and get it's absolute value
11+
function getAbs(int256 _n) public pure returns (int256 result) {
12+
if (_n < 0) {
13+
result = -(_n);
14+
} else {
15+
result = _n;
16+
}
17+
}
18+
}

src/Maths/AddArray.sol

+30-30
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
3-
4-
/**
5-
* @title Array Addition.
6-
* @author [Anthony (fps)](https://github.com/fps8k)
7-
* @dev Contract to demonstrate how an array is added.
8-
*/
9-
10-
contract AddArray {
11-
/**
12-
* @dev Takes in an array of numbers and adds them and returns the cumultative total.
13-
* @param _arr array of numbers
14-
* @return total => sum of array.
15-
*/
16-
function addArr(uint256[] memory _arr) public pure returns (uint256 total) {
17-
/// @dev Initialize the total we need to return to 0.
18-
uint256 sum = 0;
19-
20-
/// @dev Loop through the array.
21-
for (uint256 i = 0; i < _arr.length; i++) {
22-
/// @dev On every element, add the value of the element to the current sum.
23-
/// @dev For sums > the maximum uint value, solidity versions > 0.8.0 will revert on overflow.
24-
sum += _arr[i];
25-
}
26-
27-
/// @dev Return the total.
28-
total = sum;
29-
}
30-
}
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
/**
5+
* @title Array Addition.
6+
* @author [Anthony (fps)](https://github.com/fps8k)
7+
* @dev Contract to demonstrate how an array is added.
8+
*/
9+
10+
contract AddArray {
11+
/**
12+
* @dev Takes in an array of numbers and adds them and returns the cumultative total.
13+
* @param _arr array of numbers
14+
* @return total => sum of array.
15+
*/
16+
function addArr(uint256[] memory _arr) public pure returns (uint256 total) {
17+
/// @dev Initialize the total we need to return to 0.
18+
uint256 sum = 0;
19+
20+
/// @dev Loop through the array.
21+
for (uint256 i = 0; i < _arr.length; i++) {
22+
/// @dev On every element, add the value of the element to the current sum.
23+
/// @dev For sums > the maximum uint value, solidity versions > 0.8.0 will revert on overflow.
24+
sum += _arr[i];
25+
}
26+
27+
/// @dev Return the total.
28+
total = sum;
29+
}
30+
}

src/Maths/AliquotSum.sol

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
// SPDX-License-Identifier: MIT
2-
pragma solidity ^0.8.0;
3-
4-
/**
5-
* @title Get the absoule value of an integer.
6-
* @author [Perelyn](https://github.com/Perelyn-sama)
7-
*/
8-
contract AliquotSum {
9-
/// Get the Aliquote sum of a positive integer
10-
function getAliquotSum(uint256 _n) public pure returns (uint256 result) {
11-
for (uint256 i = 1; i < _n - 1; i++) {
12-
_n % i == 0 ? result += i : i;
13-
}
14-
return result;
15-
}
16-
}
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.0;
3+
4+
/**
5+
* @title Get the absoule value of an integer.
6+
* @author [Perelyn](https://github.com/Perelyn-sama)
7+
*/
8+
contract AliquotSum {
9+
/// Get the Aliquote sum of a positive integer
10+
function getAliquotSum(uint256 _n) public pure returns (uint256 result) {
11+
for (uint256 i = 1; i < _n - 1; i++) {
12+
_n % i == 0 ? result += i : i;
13+
}
14+
return result;
15+
}
16+
}

0 commit comments

Comments
 (0)