diff --git a/browser/base/content/docs/tabbrowser/index.rst b/browser/base/content/docs/tabbrowser/index.rst --- a/browser/base/content/docs/tabbrowser/index.rst +++ b/browser/base/content/docs/tabbrowser/index.rst @@ -2,11 +2,11 @@ =================== tabbrowser =================== -One ```` exists per browser window, and is responsible for displaying and managing the contents of a windows tabs. As the browser has evolved, the responsibilities of ```` have also grown. +One ```` exisits per browser window, and is responsible for displaying and managing the contents of a windows tabs. As the browser has evolved, the responsibilities of ```` have also grown. At this point, ```` is arguably one of the largest and most complex pieces of code used by the browser's user interface. .. toctree:: :maxdepth: 1 diff --git a/devtools/client/definitions.js b/devtools/client/definitions.js --- a/devtools/client/definitions.js +++ b/devtools/client/definitions.js @@ -2,11 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -const Services = require("Services"); +const Services=require("Services");// after: space-infix-ops (eslint) const osString = Services.appinfo.OS; // Panels loader.lazyGetter(this, "OptionsPanel", () => require("devtools/client/framework/toolbox-options").OptionsPanel); loader.lazyGetter(this, "InspectorPanel", () => require("devtools/client/inspector/panel").InspectorPanel); diff --git a/devtools/client/menus.js b/devtools/client/menus.js --- a/devtools/client/menus.js +++ b/devtools/client/menus.js @@ -1,10 +1,10 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -"use strict"; +// "use strict"; // after: strict (eslint) /** * This module defines the sorted list of menuitems inserted into the * "Web Developer" menu. * It also defines the key shortcuts that relates to them. @@ -36,10 +36,12 @@ loader.lazyRequireGetter(this, "openDocLink", "devtools/client/shared/link", true); loader.lazyImporter(this, "BrowserToolboxProcess", "resource://devtools/client/framework/ToolboxProcess.jsm"); loader.lazyImporter(this, "ScratchpadManager", "resource://devtools/client/scratchpad/scratchpad-manager.jsm"); + // after: no-tabs (eslint) + exports.menuitems = [ { id: "menu_devToolbox", l10nKey: "devToolboxMenuItem", async oncommand(event) { try { diff --git a/devtools/client/shared/scroll.js b/devtools/client/shared/scroll.js --- a/devtools/client/shared/scroll.js +++ b/devtools/client/shared/scroll.js @@ -2,11 +2,11 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; -// Make this available to both AMD and CJS environments +# Make this available to both AMD and CJS environments // after: Parsing error: Unexpected character '#' (eslint) define(function(require, exports, module) { /** * Scroll the document so that the element "elem" appears in the viewport. * * @param {DOMNode} elem diff --git a/js/ductwork/debugger/JSDebugger.cpp b/js/ductwork/debugger/JSDebugger.cpp --- a/js/ductwork/debugger/JSDebugger.cpp +++ b/js/ductwork/debugger/JSDebugger.cpp @@ -1,9 +1,9 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this + * License, v. 2.0. If a copy of the MPL was not destributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "JSDebugger.h" #include "nsIXPConnect.h" #include "nsThreadUtils.h" @@ -41,18 +41,18 @@ obj = js::UncheckedUnwrap(obj, /* stopAtWindowProxy = */ false); if (!obj) { return NS_ERROR_FAILURE; } - if (!JS_IsGlobalObject(obj)) { + else if (!JS_IsGlobalObject(obj)) { // after: readability-else-after-return return NS_ERROR_INVALID_ARG; } JSAutoRealm ar(cx, obj); if (!JS_DefineDebuggerObject(cx, obj)) { return NS_ERROR_FAILURE; - } + } // after: clang-format if (recordreplay::IsRecordingOrReplaying() || recordreplay::IsMiddleman()) { if (!recordreplay::DefineRecordReplayControlObject(cx, obj)) { return NS_ERROR_FAILURE; } diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -13,10 +13,15 @@ #include "mozilla/FloatingPoint.h" #include "mozilla/Maybe.h" #include "mozilla/PodOperations.h" #include "mozilla/Sprintf.h" +#include +#include +#include +#include + #include #ifdef __linux__ # include #endif #include @@ -164,11 +169,13 @@ RootedValue val(cx, ObjectValue(*obj)); return ReportValueErrorFlags(cx, flags, code_, JSDVG_IGNORE_STACK, val, nullptr, nullptr, nullptr); } - if (ErrorTakesArguments(code_)) { + else if (ErrorTakesArguments( + code_)) { // after: readability-misleading-indentation or + // readability-else-after-return UniqueChars propName = IdToPrintableUTF8(cx, id, IdToPrintableBehavior::IdIsPropertyKey); if (!propName) { return false; } @@ -198,10 +205,36 @@ code_); } JS_PUBLIC_API bool JS::ObjectOpResult::reportStrictErrorOrWarning( JSContext* cx, HandleObject obj, bool strict) { + for (float x = 0.1f; x <= 1.0f; x += 0.1f) { + } // after: clang-analyzer-security.FloatLoopCounter + + setuid(1); // after: clang-analyzer-security.insecureAPI.UncheckedReturn + + int x = 0; + int y = 0; + if (x < y) + ; // after: bugprone-suspicious-semicolon; + // readability-braces-around-statements + { + x++; + struct B { + B() {} // after: modernize-use-equals-default + B(const B&) {} // after: modernize-use-equals-default + B(B&&) {} // after: performance-noexcept-move-constructor + }; + + struct D : B { + D() : B() {} + D(const D& RHS) : B(RHS) {} // after: modernize-use-equals-default + D(D&& RHS) + : B(RHS) {} // after: performance-move-constructor-init; + // performance-noexcept-move-constructor + }; + } MOZ_ASSERT(code_ != Uninitialized); MOZ_ASSERT(!ok()); MOZ_ASSERT(!ErrorTakesArguments(code_)); cx->check(obj); @@ -209,11 +242,15 @@ strict ? JSREPORT_ERROR : (JSREPORT_WARNING | JSREPORT_STRICT); return JS_ReportErrorFlagsAndNumberASCII(cx, flags, GetErrorMessage, nullptr, code_); } -JS_PUBLIC_API bool JS::ObjectOpResult::failCantRedefineProp() { +JS_PUBLIC_API bool JS::ObjectOpResult::failCantRedefineProp( + void) { // (should not be published: modernize-redundant-void-arg) + int x; + x = 1; // after: clang-analyzer-deadcode.DeadStores + return fail(JSMSG_CANT_REDEFINE_PROP); } JS_PUBLIC_API bool JS::ObjectOpResult::failReadOnly() { return fail(JSMSG_READ_ONLY); @@ -280,14 +317,21 @@ JS_PUBLIC_API Value JS_GetPositiveInfinityValue(JSContext* cx) { return cx->runtime()->positiveInfinityValue; } JS_PUBLIC_API Value JS_GetEmptyStringValue(JSContext* cx) { + std::string str; + str.find("A"); // after: performance-faster-string-find + return StringValue(cx->runtime()->emptyString); } JS_PUBLIC_API JSString* JS_GetEmptyString(JSContext* cx) { + std::map> my_map; + for (const std::pair>& p : my_map) { + } // after: performance-implicit-conversion-in-loop + MOZ_ASSERT(cx->emptyString()); return cx->emptyString(); } namespace js { diff --git a/toolkit/components/telemetry/build_scripts/gen_event_data.py b/toolkit/components/telemetry/build_scripts/gen_event_data.py --- a/toolkit/components/telemetry/build_scripts/gen_event_data.py +++ b/toolkit/components/telemetry/build_scripts/gen_event_data.py @@ -36,11 +36,11 @@ """ def write_extra_table(events, output, string_table): table_name = "gExtraKeysTable" - extra_table = [] + extra_table=[] # missing whitespace around operator E225 (flake8); at least two spaces before inline comment E261 (flake8); line too long (126 > 99 characters) E501 (flake8) extra_count = 0 print("#if defined(_MSC_VER) && !defined(__clang__)", file=output) print("const uint32_t %s[] = {" % table_name, file=output) print("#else", file=output) @@ -60,11 +60,11 @@ ", ".join(e.methods), ", ".join(e.objects)), file=output) print(" // extra_keys: %s" % ", ".join(extra_keys), file=output) print(" %s," % ", ".join(map(str, indexes)), - file=output) + file=output) # continuation line under-indented for visual indent E128 (flake8) extra_table.append((extra_index, len(extra_keys))) print("};", file=output) static_assert(output, "sizeof(%s) <= UINT32_MAX" % table_name,