mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
More style checks.
This commit is contained in:
parent
f003696d7e
commit
8ca6715e18
@ -240,7 +240,7 @@ bool contains(T const& _t, V const& _v)
|
||||
/// place at the end, but already visited elements might be invalidated.
|
||||
/// If nothing is replaced, no copy is performed.
|
||||
template <typename T, typename F>
|
||||
void iterateReplacing(std::vector<T>& _vector, const F& _f)
|
||||
void iterateReplacing(std::vector<T>& _vector, F const& _f)
|
||||
{
|
||||
// Concept: _f must be Callable, must accept param T&, must return optional<vector<T>>
|
||||
bool useModified = false;
|
||||
|
@ -134,7 +134,7 @@ void ErrorReporter::clear()
|
||||
m_errorList.clear();
|
||||
}
|
||||
|
||||
void ErrorReporter::declarationError(SourceLocation const& _location, SecondarySourceLocation const&_secondaryLocation, string const& _description)
|
||||
void ErrorReporter::declarationError(SourceLocation const& _location, SecondarySourceLocation const& _secondaryLocation, string const& _description)
|
||||
{
|
||||
error(
|
||||
Error::Type::DeclarationError,
|
||||
|
@ -57,7 +57,7 @@ Error::Error(Type _type, SourceLocation const& _location, string const& _descrip
|
||||
*this << errinfo_comment(_description);
|
||||
}
|
||||
|
||||
Error::Error(Error::Type _type, const std::string& _description, const SourceLocation& _location):
|
||||
Error::Error(Error::Type _type, std::string const& _description, SourceLocation const& _location):
|
||||
Error(_type)
|
||||
{
|
||||
if (!_location.isEmpty())
|
||||
|
@ -653,7 +653,7 @@ void CompilerUtils::convertType(
|
||||
bool chopSignBitsPending = _chopSignBits && targetTypeCategory == Type::Category::Integer;
|
||||
if (chopSignBitsPending)
|
||||
{
|
||||
const IntegerType& targetIntegerType = dynamic_cast<const IntegerType &>(_targetType);
|
||||
const IntegerType& targetIntegerType = dynamic_cast<IntegerType const&>(_targetType);
|
||||
chopSignBitsPending = targetIntegerType.isSigned();
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ bool hasPayableFunctions(ContractDefinition const& _contract)
|
||||
void ContractCompiler::appendFunctionSelector(ContractDefinition const& _contract)
|
||||
{
|
||||
map<FixedHash<4>, FunctionTypePointer> interfaceFunctions = _contract.interfaceFunctions();
|
||||
map<FixedHash<4>, const eth::AssemblyItem> callDataUnpackerEntryPoints;
|
||||
map<FixedHash<4>, eth::AssemblyItem const> callDataUnpackerEntryPoints;
|
||||
|
||||
if (_contract.isLibrary())
|
||||
{
|
||||
|
@ -473,7 +473,7 @@ void StorageByteArrayElement::setToZero(SourceLocation const&, bool _removeRefer
|
||||
m_context << Instruction::SWAP1 << Instruction::SSTORE;
|
||||
}
|
||||
|
||||
StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, const ArrayType& _arrayType):
|
||||
StorageArrayLength::StorageArrayLength(CompilerContext& _compilerContext, ArrayType const& _arrayType):
|
||||
LValue(_compilerContext, _arrayType.memberType("length").get()),
|
||||
m_arrayType(_arrayType)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ smt::Expression SymbolicVariable::increaseIndex()
|
||||
SymbolicBoolVariable::SymbolicBoolVariable(
|
||||
TypePointer _type,
|
||||
string const& _uniqueName,
|
||||
smt::SolverInterface&_interface
|
||||
smt::SolverInterface& _interface
|
||||
):
|
||||
SymbolicVariable(move(_type), _uniqueName, _interface)
|
||||
{
|
||||
@ -102,7 +102,7 @@ SymbolicFixedBytesVariable::SymbolicFixedBytesVariable(
|
||||
SymbolicFunctionVariable::SymbolicFunctionVariable(
|
||||
TypePointer _type,
|
||||
string const& _uniqueName,
|
||||
smt::SolverInterface&_interface
|
||||
smt::SolverInterface& _interface
|
||||
):
|
||||
SymbolicVariable(move(_type), _uniqueName, _interface),
|
||||
m_declaration(m_interface.newVariable(currentName(), smtSort(*m_type)))
|
||||
|
@ -118,7 +118,7 @@ string Natspec::extractDoc(multimap<string, DocTag> const& _tags, string const&
|
||||
return value;
|
||||
}
|
||||
|
||||
Json::Value Natspec::devDocumentation(std::multimap<std::string, DocTag> const &_tags)
|
||||
Json::Value Natspec::devDocumentation(std::multimap<std::string, DocTag> const& _tags)
|
||||
{
|
||||
Json::Value json(Json::objectValue);
|
||||
auto dev = extractDoc(_tags, "dev");
|
||||
|
@ -59,7 +59,7 @@ private:
|
||||
/// @param _tags docTags that are used.
|
||||
/// @return A JSON representation
|
||||
/// of the contract's developer documentation
|
||||
static Json::Value devDocumentation(std::multimap<std::string, DocTag> const &_tags);
|
||||
static Json::Value devDocumentation(std::multimap<std::string, DocTag> const& _tags);
|
||||
};
|
||||
|
||||
} //solidity NS
|
||||
|
@ -44,8 +44,8 @@ public:
|
||||
void operator()(Block& _block) override;
|
||||
private:
|
||||
void simplify(std::vector<Statement>& _statements);
|
||||
bool expressionAlwaysTrue(Expression const &_expression);
|
||||
bool expressionAlwaysFalse(Expression const &_expression);
|
||||
bool expressionAlwaysTrue(Expression const& _expression);
|
||||
bool expressionAlwaysFalse(Expression const& _expression);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -19,8 +19,11 @@ FORMATERROR=$(
|
||||
(
|
||||
git grep -nIE "\<(if|for)\(" -- '*.h' '*.cpp' # no space after "if" or "for"
|
||||
git grep -nIE "\<if\>\s*\(.*\)\s*\{\s*$" -- '*.h' '*.cpp' # "{\n" on same line as "if" / "for"
|
||||
git grep -nIE "\(const " -- '*.h' '*.cpp' # const on left side of type
|
||||
git grep -nIE "[,\(<]\s*const " -- '*.h' '*.cpp' # const on left side of type
|
||||
git grep -nIE "^ [^*]|[^*] | [^*]" -- '*.h' '*.cpp' # uses spaces for indentation or mixes spaces and tabs
|
||||
git grep -nIE "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
|
||||
# right-aligned reference pointer star (needs to exclude return and comments)
|
||||
git grep -nIE "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" -- '*.h' '*.cpp' | egrep -v "return [*]" | egrep -v "^* [*]" | egrep -v "^*//.*"
|
||||
) | egrep -v "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" | egrep -v "^test/"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user