Skip to content

Commit

Permalink
[MERGE #5583 @rhuanjl] Add end of file new line check fix #496
Browse files Browse the repository at this point in the history
Merge pull request #5583 from rhuanjl:endOfFile

Per issue #496 augment the existing line ending check to also check to ensure that each file ends in a newline.

Note, per logic in check_eol.sh this test is run only on:
1. Files edited in the current PR
2. Files that are not JS test files OR any cmd, baseline, wasm, vcxproj or sln files

Also note:
1. As this runs only on files edited din current PR it won't catch any historic mistakes
2. It doesn't check JS test files - this seemed odd to me but chose to leave it

CC @dilijev
  • Loading branch information
dilijev committed Aug 28, 2018
2 parents 8216761 + 2ee13d2 commit 6d96d5b
Show file tree
Hide file tree
Showing 91 changed files with 96 additions and 90 deletions.
2 changes: 1 addition & 1 deletion Build/Chakra.Build.Clang.targets
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@
>
</CL>
</Target>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Build/NuGet/Microsoft.ChakraCore.vc140.targets
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\lib\native\v140\x86\Release\ChakraCore.dll" />
<ReferenceCopyLocalPaths Include="$(MSBuildThisFileDirectory)..\..\lib\native\v140\x86\Release\ChakraCore.pdb" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion Build/NuGet/package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Foreach ($nuspec in $(Get-Item $packageRoot\*.nuspec))
If (Test-Path $compiledNuspec)
{
Remove-Item $compiledNuspec
}
}
2 changes: 1 addition & 1 deletion bin/ch/262.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ var $262 = {
getReport: function () { return WScript.GetReport(); },
},
};
)===="
)===="
2 changes: 1 addition & 1 deletion jenkins/check_eol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi
ERRFILE=check_eol.sh.err
rm -f $ERRFILE

git diff --name-only `git merge-base origin/master HEAD` HEAD | grep -v -E "(test/.*\\.js|\\.cmd|\\.baseline|\\.wasm|\\.vcxproj|\\.vcproj|\\.sln)" | xargs -I % ./jenkins/check_file_eol.sh %
git diff --name-only `git merge-base origin/master HEAD` HEAD | grep -v -E "(test/.*\\.js|\\.cmd|\\.baseline|\\.wasm|\\.wast|\\.vcxproj|\\.vcproj|\\.sln)" | xargs -I % ./jenkins/check_file_eol.sh %

if [ -e $ERRFILE ]; then # if error file exists then there were errors
>&2 echo "--------------" # leading >&2 means echo to stderr
Expand Down
6 changes: 6 additions & 0 deletions jenkins/check_file_eol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ if [ $? -eq 0 ]; then # grep found matches ($?==0), so we found CR (0x0d) in the
echo "--------------" >> $ERRFILE # same length as '--- ERRORS ---'
fi

# Check that each file ends in a newline character
tail -c1 $1 | od -x | grep '000a' > $ERRFILETEMP
if [ $? -ne 0 ]; then # last character is not a newline
echo "ERROR: $1 does not end in a new line" >> $ERRFILE
fi

rm -f $ERRFILETEMP
2 changes: 1 addition & 1 deletion lib/Backend/AsmJsJITInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ AsmJsJITInfo::AccessNeedsBoundCheck(uint offset) const
{
return offset >= 0x10000;
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/BackendOpCodeAttrAsmJs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ namespace OpCodeAttrAsmJs
}

}; // OpCodeAttrAsmJs
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/BackendOpCodeAttrAsmJs.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ namespace OpCodeAttrAsmJs
bool HasProfiledOp(Js::OpCodeAsmJs opcode);
bool IsProfiledOp(Js::OpCodeAsmJs opcode);
};
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/CodeGenNumberAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,4 +571,4 @@ XProcNumberPageSegmentManager::~XProcNumberPageSegmentManager()
temp = (XProcNumberPageSegmentImpl*)next;
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/EquivalentTypeSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ void EquivalentTypeSet::SortAndRemoveDuplicates()
this->sortedAndDuplicatesRemoved = true;
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/GlobOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17464,4 +17464,4 @@ void GlobOpt::PRE::TraceFailedPreloadInLandingPad(const Loop *const loop, Proper
Output::Print(_u("\n"));
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/GlobOptIntBounds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3242,4 +3242,4 @@ GlobOpt::EmitIntRangeChecks(IR::Instr* instr)
EmitIntRangeChecks(instr, instr->GetDst());
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/IRBuilderAsmJs.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,4 @@ class IRBuilderAsmJs
#undef Uint8x16Type
};

#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/JitTransferData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ void JitTransferData::Cleanup()
}
midl_user_free(entries);
}
}
}
2 changes: 1 addition & 1 deletion lib/Backend/JitTransferData.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ class JitTransferData
void Cleanup();
private:
void EnsureJitTimeTypeRefs(Recycler* recycler);
};
};
2 changes: 1 addition & 1 deletion lib/Backend/LowerMDShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8633,4 +8633,4 @@ IR::BranchInstr*
LowererMD::InsertMissingItemCompareBranch(IR::Opnd* compareSrc, IR::Opnd* missingItemOpnd, Js::OpCode opcode, IR::LabelInstr* target, IR::Instr* insertBeforeInstr)
{
return this->lowererMDArch.InsertMissingItemCompareBranch(compareSrc, missingItemOpnd, opcode, target, insertBeforeInstr);
}
}
2 changes: 1 addition & 1 deletion lib/Backend/LowerMDSharedSimd128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3306,4 +3306,4 @@ BYTE LowererMD::Simd128GetTypedArrBytesPerElem(ValueType arrType)
return (1 << Lowerer::GetArrayIndirScale(arrType));
}

#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/NativeEntryPointData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,4 +566,4 @@ OOPNativeEntryPointData::DeleteNativeDataBuffer(char * nativeDataBuffer)
midl_user_free(buffer);
}

#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/NativeEntryPointData.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,4 @@ class OOPNativeEntryPointData : public NativeEntryPointData
#endif
};

#endif
#endif
2 changes: 1 addition & 1 deletion lib/Backend/amd64/LowererMDArch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3466,4 +3466,4 @@ LowererMDArch::InsertMissingItemCompareBranch(IR::Opnd* compareSrc, IR::Opnd* mi
}

return this->lowererMD->m_lowerer->InsertCompareBranch(missingItemOpnd, compareSrcUint64Opnd, opcode, target, insertBeforeInstr);
}
}
2 changes: 1 addition & 1 deletion lib/Backend/amd64/machvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ static const int MachStackAlignment = MachPtr;
static const int MachArgsSlotOffset = MachPtr;
static const int MachMaxInstrSize = 12;
static const unsigned __int64 MachSignBit = 0x8000000000000000;
static const int MachSimd128 = 16;
static const int MachSimd128 = 16;
2 changes: 1 addition & 1 deletion lib/Backend/arm/machvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ static const int MachPtr = 4;
static const int MachDouble = 8;
static const int MachRegDouble = 8;
static const int MachArgsSlotOffset = MachPtr;
static const int MachStackAlignment = MachDouble;
static const int MachStackAlignment = MachDouble;
2 changes: 1 addition & 1 deletion lib/Backend/arm64/machvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ static const int MachDouble = 8;
static const int MachRegDouble = 8;
static const int MachArgsSlotOffset = MachPtr;
static const int MachStackAlignment = 16; // On ARM64 SP needs to be 16 byte aligned for load/store
static const unsigned __int64 MachSignBit = 0x8000000000000000;
static const unsigned __int64 MachSignBit = 0x8000000000000000;
2 changes: 1 addition & 1 deletion lib/Backend/i386/LowererMDArch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4224,4 +4224,4 @@ LowererMDArch::InsertMissingItemCompareBranch(IR::Opnd* compareSrc, IR::Opnd* mi
}

return this->lowererMD->m_lowerer->InsertCompareBranch(missingItemOpnd, compareSrcUint32Opnd, opcode, target, insertBeforeInstr);
}
}
2 changes: 1 addition & 1 deletion lib/Backend/i386/machvalues.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ static const int MachMaxInstrSize = 11;
static const int MachArgsSlotOffset = MachPtr;
static const int MachStackAlignment = MachDouble;
static const unsigned int MachSignBit = 0x80000000;
static const int MachSimd128 = 16;
static const int MachSimd128 = 16;
2 changes: 1 addition & 1 deletion lib/Common/Core/Assertions.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ struct IsSame<T1, T1>
{
IsTrue = true
};
};
};
2 changes: 1 addition & 1 deletion lib/Common/DataStructures/ClusterList.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,4 +417,4 @@ class SegmentClusterList
Output::Print(_u("]\n"));
}
#endif
};
};
2 changes: 1 addition & 1 deletion lib/Common/Memory/AllocatorTelemetryStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ struct AllocatorSizes
size_t reservedBytes;
size_t committedBytes;
size_t numberOfSegments;
};
};
2 changes: 1 addition & 1 deletion lib/Common/Memory/BucketStatsReporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,4 @@ class BucketStatsReporter
#endif
};

};
};
2 changes: 1 addition & 1 deletion lib/Common/Memory/CollectionState.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ enum CollectionState
CollectionStateConcurrentMarkWeakRef = Collection_ConcurrentMark | Collection_ExecutingConcurrent | Collection_WeakRefMark,
};

}
}
2 changes: 1 addition & 1 deletion lib/Common/Memory/CustomHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1210,4 +1210,4 @@ CodePageAllocators<SectionAllocWrapper, PreReservedSectionAllocWrapper>::FreeLoc
} // namespace CustomHeap

} // namespace Memory
#endif // ENABLE_NATIVE_CODEGEN || DYNAMIC_INTERPRETER_THUNK
#endif // ENABLE_NATIVE_CODEGEN || DYNAMIC_INTERPRETER_THUNK
2 changes: 1 addition & 1 deletion lib/Common/Memory/CustomHeap.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,4 @@ BucketId GetBucketForSize(DECLSPEC_GUARD_OVERFLOW size_t bytes);
void FillDebugBreak(_Out_writes_bytes_all_(byteCount) BYTE* buffer, _In_ size_t byteCount);
} // namespace CustomHeap
} // namespace Memory
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Common/Memory/DelayDeletingFunctionTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ void DelayDeletingFunctionTable::DeleteFunctionTable(void* functionTable)
NtdllLibrary::Instance->DeleteGrowableFunctionTable(functionTable);
}

#endif
#endif
2 changes: 1 addition & 1 deletion lib/Common/Memory/HeapInfoManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@ class HeapInfoManager
size_t unusedPartialCollectFreeBytes;
#endif
};
}
}
2 changes: 1 addition & 1 deletion lib/Common/Memory/RecyclerSweepManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,4 +586,4 @@ size_t RecyclerSweepManager::GetPendingMergeNewHeapBlockCount(HeapInfo const * h
{
return this->defaultHeapRecyclerSweep.GetPendingMergeNewHeapBlockCount(heapInfo);
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Common/Memory/RecyclerSweepManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ RecyclerSweepManager::GetHeapBlockCount(HeapBucketT<TBlockType> const * heapBuck
return this->defaultHeapRecyclerSweep.GetHeapBlockCount(heapBucket);
}
#endif
};
};
2 changes: 1 addition & 1 deletion lib/Common/Memory/XDataAllocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ struct DelayDeletingFunctionTable
static bool IsEmpty();
static void DeleteFunctionTable(void* functionTable);
};
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Jsrt/JsrtDebugEventObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,4 @@ JsrtDebugDocumentManager::BreakpointDebugDocumentDictionary * JsrtDebugDocumentM
}
return breakpointDebugDocumentDictionary;
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Jsrt/JsrtDebugManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,4 +763,4 @@ JsDiagDebugEvent JsrtDebugManager::GetDebugEventFromStopType(Js::StopType stopTy

return JsDiagDebugEventBreakpoint;
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Jsrt/JsrtDebugUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,4 @@ const char16 * JsrtDebugUtils::GetDebugPropertyName(JsrtDebugPropertyId property
Assert(false);
return _u("");
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Jsrt/JsrtDebuggerObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,4 +952,4 @@ void JsrtDebugStackFrames::ClearFrameDictionary()
this->framesDictionary->Clear();
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Parser/BGParseManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,4 +650,4 @@ void BGParseWorkItem::WaitForCompletion()

this->complete->Wait();
}
}
}
2 changes: 1 addition & 1 deletion lib/Parser/BGParseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ class BGParseWorkItem sealed : public JsUtil::Job
// Output data
byte * bufferReturn;
DWORD bufferReturnBytes;
};
};
2 changes: 1 addition & 1 deletion lib/Parser/Parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -1210,4 +1210,4 @@ class Parser
public:
charcount_t GetSourceIchLim() { return m_sourceLim; }
static BOOL NodeEqualsName(ParseNodePtr pnode, LPCOLESTR sz, uint32 cch);
};
};
2 changes: 1 addition & 1 deletion lib/Parser/perrors.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ LSC_ERROR_MSG(1092, ERRLabelBeforeAsyncFncDeclaration, "Labels not allowed befor
LSC_ERROR_MSG(1093, ERRLabelBeforeClassDeclaration, "Labels not allowed before class declaration")
LSC_ERROR_MSG(1094, ERRLabelFollowedByEOF, "Unexpected end of script after a label.")
LSC_ERROR_MSG(1095, ERRFunctionAfterLabelInStrict, "Function declarations not allowed after a label in strict mode.")
LSC_ERROR_MSG(1096, ERRAwaitAsLabelInAsync, "Use of 'await' as label in async function is not allowed.")
LSC_ERROR_MSG(1096, ERRAwaitAsLabelInAsync, "Use of 'await' as label in async function is not allowed.")
2 changes: 1 addition & 1 deletion lib/Parser/ptree.h
Original file line number Diff line number Diff line change
Expand Up @@ -1093,4 +1093,4 @@ template <OpCode nop> class OpCodeTrait;
typedef ParseNode##nk ParseNodeType; \
static const bool AllowDefer = ((ok) & fnopAllowDefer) != 0; \
};
#include "ptlist.h"
#include "ptlist.h"
2 changes: 1 addition & 1 deletion lib/Runtime/Base/PerfHintDescriptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ PERFHINT_REASON(HeapArgumentsDueToWriteToFormals, true, PerfHintLevels::L1,
PERFHINT_REASON(HeapArgumentsDueToNonLocalRef, true, PerfHintLevels::L1, _u("Arguments object not optimized as there were some nested functions or non-local refs found in nested functions"), _u("Scope object creation is required in this case"), _u("Check for nested functions and non-local refs inside") )
PERFHINT_REASON(HeapArgumentsModification, true, PerfHintLevels::L1, _u("Modification to arguments"), _u("Slower lookups, high overhead in the JIT code"), _u("Avoid modification to the arguments"))
PERFHINT_REASON(HeapArgumentsCreated, true, PerfHintLevels::L1, _u("Arguments object not optimized"), _u("Slower lookups, high overhead in the JIT code"), _u("Check the usage of arguments in the function"))
PERFHINT_REASON(PolymorphicInilineCap, true, PerfHintLevels::L1, _u("Function has reached polymorphic-inline cap"), _u("This function will not inline more than 4 functions for this call-site."), _u("Check the polymorphic usage of this function"))
PERFHINT_REASON(PolymorphicInilineCap, true, PerfHintLevels::L1, _u("Function has reached polymorphic-inline cap"), _u("This function will not inline more than 4 functions for this call-site."), _u("Check the polymorphic usage of this function"))
2 changes: 1 addition & 1 deletion lib/Runtime/ByteCode/AsmJsByteCodeWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ namespace Js
#undef IMP_IWASM
#endif

#endif
#endif
2 changes: 1 addition & 1 deletion lib/Runtime/ByteCode/ByteCodeSerializeFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
// of these flags to indicate how to allocate the memory. The absence of both flags
// indicates that no allocation is needed.
#define GENERATE_BYTE_CODE_COTASKMEMALLOC 0x00000008
#define GENERATE_BYTE_CODE_ALLOC_ANEW 0x00000010
#define GENERATE_BYTE_CODE_ALLOC_ANEW 0x00000010
2 changes: 1 addition & 1 deletion lib/Runtime/ByteCode/OpCodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -862,4 +862,4 @@ MACRO_EXTEND_WMS( NewPropIdArrForCompProps, Reg1Unsigned1, OpSideEffect)
#undef MACRO_WMS_WITH_DBG_ATTR
#undef MACRO_EXTEND_WITH_DBG_ATTR
#undef MACRO_EXTEND_WMS_WITH_DBG_ATTR
#undef MACRO_BACKEND_ONLY_WITH_DBG_ATTR
#undef MACRO_BACKEND_ONLY_WITH_DBG_ATTR
2 changes: 1 addition & 1 deletion lib/Runtime/Debug/BreakpointProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ namespace Js
statement->statement.begin = this->characterOffset;
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Runtime/Debug/DebugContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,4 @@ namespace Js
});
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Runtime/Debug/DebugDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,4 @@ namespace Js
return TRUE;
}
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Runtime/Debug/DebugManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,4 @@ AutoSetDispatchHaltFlag::~AutoSetDispatchHaltFlag()
Assert(m_scriptContext->GetDebugContext()->GetProbeContainer()->IsPrimaryBrokenToDebuggerContext());
m_scriptContext->GetDebugContext()->GetProbeContainer()->SetIsPrimaryBrokenToDebuggerContext(false);
}
#endif
#endif
2 changes: 1 addition & 1 deletion lib/Runtime/Debug/DebuggingFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ void DebuggingFlags::SetIsBuiltInWrapperPresent(bool value /* = true */)
{
m_isBuiltInWrapperPresent = value;
}
#endif
#endif
Loading

0 comments on commit 6d96d5b

Please sign in to comment.