diff --git a/docs/accounts/erc1271.md b/docs/accounts/erc1271.md
index a0f7d0459..a68fb2163 100644
--- a/docs/accounts/erc1271.md
+++ b/docs/accounts/erc1271.md
@@ -5,9 +5,9 @@ ERC1271 mixin with nested EIP-712 approach.
-Inherits:
+Inherits:
-- `utils/EIP712.sol`
+- `utils/EIP712.sol`
diff --git a/docs/accounts/erc4337.md b/docs/accounts/erc4337.md
index 15f7554fd..50518010f 100644
--- a/docs/accounts/erc4337.md
+++ b/docs/accounts/erc4337.md
@@ -22,12 +22,12 @@ for security reviews. This implementation is intended to serve as a base referen
for smart account developers working in such companies. If you are using this
implementation, please do get one or more security reviews before deployment.
-Inherits:
+Inherits:
-- `auth/Ownable.sol`
-- `utils/UUPSUpgradeable.sol`
-- `accounts/Receiver.sol`
-- `accounts/ERC1271.sol`
+- `auth/Ownable.sol`
+- `utils/UUPSUpgradeable.sol`
+- `accounts/Receiver.sol`
+- `accounts/ERC1271.sol`
diff --git a/docs/accounts/erc6551.md b/docs/accounts/erc6551.md
index cedb3e1a0..b11425b79 100644
--- a/docs/accounts/erc6551.md
+++ b/docs/accounts/erc6551.md
@@ -34,11 +34,11 @@ user operation validation functionality (and use ERC6551's execution functionali
- Please refer to the official [ERC6551](https://github.com/erc6551/reference) reference
for latest updates on the ERC6551 standard, as well as canonical registry information.
-Inherits:
+Inherits:
-- `utils/UUPSUpgradeable.sol`
-- `accounts/Receiver.sol`
-- `accounts/ERC1271.sol`
+- `utils/UUPSUpgradeable.sol`
+- `accounts/Receiver.sol`
+- `accounts/ERC1271.sol`
diff --git a/docs/accounts/erc7821.md b/docs/accounts/erc7821.md
index 9167456e4..a085a3612 100644
--- a/docs/accounts/erc7821.md
+++ b/docs/accounts/erc7821.md
@@ -5,9 +5,9 @@ Minimal batch executor mixin.
-Inherits:
+Inherits:
-- `accounts/Receiver.sol`
+- `accounts/Receiver.sol`
diff --git a/docs/accounts/timelock.md b/docs/accounts/timelock.md
index 5f613e8ed..48fff2a33 100644
--- a/docs/accounts/timelock.md
+++ b/docs/accounts/timelock.md
@@ -5,10 +5,10 @@ Simple timelock.
-Inherits:
+Inherits:
-- `accounts/ERC7821.sol`
-- `auth/EnumerableRoles.sol`
+- `accounts/ERC7821.sol`
+- `auth/EnumerableRoles.sol`
diff --git a/docs/auth/ownableroles.md b/docs/auth/ownableroles.md
index cbdfe1b62..0e545427e 100644
--- a/docs/auth/ownableroles.md
+++ b/docs/auth/ownableroles.md
@@ -15,9 +15,9 @@ While the ownable portion follows
[EIP-173](https://eips.ethereum.org/EIPS/eip-173) for compatibility,
the nomenclature for the 2-step ownership handover may be unique to this codebase.
-Inherits:
+Inherits:
-- `auth/Ownable.sol`
+- `auth/Ownable.sol`
diff --git a/docs/tokens/erc20votes.md b/docs/tokens/erc20votes.md
index 745edbb12..f7c1d4eb2 100644
--- a/docs/tokens/erc20votes.md
+++ b/docs/tokens/erc20votes.md
@@ -5,9 +5,9 @@ ERC20 with votes based on ERC5805 and ERC6372.
-Inherits:
+Inherits:
-- `tokens/ERC20.sol`
+- `tokens/ERC20.sol`
diff --git a/docs/tokens/erc4626.md b/docs/tokens/erc4626.md
index 3613c47aa..a1238ea15 100644
--- a/docs/tokens/erc4626.md
+++ b/docs/tokens/erc4626.md
@@ -5,9 +5,9 @@ Simple ERC4626 tokenized Vault implementation.
-Inherits:
+Inherits:
-- `tokens/ERC20.sol`
+- `tokens/ERC20.sol`
diff --git a/docs/tokens/weth.md b/docs/tokens/weth.md
index 70a594688..aa90f33a1 100644
--- a/docs/tokens/weth.md
+++ b/docs/tokens/weth.md
@@ -5,9 +5,9 @@ Simple Wrapped Ether implementation.
-Inherits:
+Inherits:
-- `tokens/ERC20.sol`
+- `tokens/ERC20.sol`
diff --git a/prep/common.js b/prep/common.js
index 9c35388c7..b8e7d4e56 100644
--- a/prep/common.js
+++ b/prep/common.js
@@ -54,7 +54,7 @@ const forEachWalkSync = (dirs, callback) => {
dirs.forEach(dir => walkSync(dir, callback));
};
-const withSmallerLineLength = (src, lineLength) => {
+const readSolWithLineLengthSync = (srcPath, lineLength) => {
const withModifiedToml = callback => {
const originalFile = path.resolve('foundry.toml');
const backupFile = path.resolve('__tmp_foundry.toml');
@@ -74,7 +74,7 @@ const withSmallerLineLength = (src, lineLength) => {
};
return withModifiedToml(() => {
const tempFile = '__tmp.sol';
- fs.writeFileSync(tempFile, src, 'utf8');
+ fs.copyFileSync(srcPath, tempFile);
runCommandSync('forge', ['fmt', tempFile]);
let content = fs.readFileSync(tempFile, 'utf8');
fs.unlinkSync(tempFile);
@@ -93,5 +93,5 @@ module.exports = {
writeAndFmtSync,
walkSync,
forEachWalkSync,
- withSmallerLineLength
+ readSolWithLineLengthSync
};
diff --git a/prep/gen-docs.js b/prep/gen-docs.js
index bf212a010..d1b29bed5 100644
--- a/prep/gen-docs.js
+++ b/prep/gen-docs.js
@@ -1,5 +1,5 @@
#!/usr/bin/env node
-const { readSync, writeSync, forEachWalkSync, hasAnyPathSequence, withSmallerLineLength } = require('./common.js');
+const { readSync, writeSync, forEachWalkSync, hasAnyPathSequence, readSolWithLineLengthSync } = require('./common.js');
const path = require('path');
async function main() {
@@ -12,7 +12,7 @@ async function main() {
'()'
);
- const hasSubString = (a, b) => a.toLowerCase().indexOf(b.toLowerCase()) !== -1;
+ const has = (a, b) => a.toLowerCase().indexOf(b.toLowerCase()) !== -1;
const replaceInTag = (src, tag, replacement) =>
src.replace(
@@ -69,7 +69,7 @@ async function main() {
});
}
return a
- .filter(x => !hasSubString(x.header, 'private'))
+ .filter(x => !has(x.header, 'private'))
.map(item => {
const m = (/^((\s+\/\/\s[^\n]+)+)/).exec(item.src);
if (m) item.note = cleanNatspecOrNote(m[0]);
@@ -80,7 +80,7 @@ async function main() {
const getSubSections = (s, r) => {
let a = [];
for (let m = null; (m = r.exec(s)) !== null; ) {
- if (!hasSubString(m[2], '///') && !/\sprivate\s/.test(m[2])) a.push(m);
+ if (!has(m[2], '///') && !/\sprivate\s/.test(m[2])) a.push(m);
}
return a;
}
@@ -140,7 +140,7 @@ async function main() {
l.replace(/^\/\/\/\s*/, '')
.replace(/^@dev\s?([\s\S]+?)\:/, '$1:\n\n')
.replace(/^Note\:/, 'Note:\n\n')
- .replace(/^[\s\S]{1,64}\:/, m => hasSubString(m, 'http') ? m : '' + m + '')
+ .replace(/^[\s\S]{1,64}\:/, m => has(m, 'http') ? m : '' + m + '')
).join('\n')
.replace(/@dev\s/g, '')
)
@@ -148,9 +148,9 @@ async function main() {
const getInherits = (s, srcPath) => coalesce(
s.match(/contract\s+[A-Za-z0-9_]+\s+is\s+([^\{]*?)\s*\{/),
- m => 'Inherits: \n\n' +
+ m => 'Inherits: \n\n' +
m[1].split(',').map(strip).map(p =>
- getImports(s, srcPath).map(q => hasSubString(q, p) ? '- `' + q + '` \n' : '').join('')
+ getImports(s, srcPath).map(q => has(q, p) ? '- `' + q + '` \n' : '').join('')
).join('')
);
@@ -164,10 +164,10 @@ async function main() {
forEachWalkSync(['src'], srcPath => {
if (!srcPath.match(/\.sol$/i)) return;
if (hasAnyPathSequence(srcPath, pathSequencesToIgnore)) return;
- if (hasSubString(srcPath, 'Milady.sol')) return;
+ if (has(srcPath, 'Milady.sol')) return;
console.log(srcPath);
- let src = withSmallerLineLength(readSync(srcPath), 80);
+ let src = readSolWithLineLengthSync(srcPath, 80);
let sections = getSections(src);
if (sections.length < 1) {
@@ -184,8 +184,7 @@ async function main() {
const docHeader = '# ' + getTitle(srcPath) + '\n\n' + getNotice(src);
let writeDoc = false;
let docChunks = [];
- for (let i = 0; i < sections.length; ++i) {
- let x = sections[i];
+ sections.forEach(x => {
let a = getStructsAndEnums(x.src);
if (a.length < 1) a = getCustomErrors(x.src);
if (a.length < 1) a = getFunctionsAndModifiers(x.src);
@@ -200,7 +199,7 @@ async function main() {
y.natspec
));
}
- }
+ });
if (writeDoc) {
writeSync(