Showing 6 of 12 total issues
Function componentDidMount
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public componentDidMount() {
const {
termSetGuid,
termSetName,
termSetCountMaxSwapToAsync,
Function getSearchTermsByText
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static getSearchTermsByText(termSetGuid: string, termSetName: string, keyword: string, resultCollectionSize: number = 10, showOnlyAvailableForTag: boolean = true) {
return new Promise((resolve, reject) => {
if (keyword === "") { return resolve([]); }
SP.SOD.executeFunc("sp.js", "SP.ClientContext", () => {
// Utils.getLayoutsPageUrl replaces SP.Utilities.Utility.getLayoutsPageUrl
Function getAllTermsByTermSet
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static getAllTermsByTermSet(termSetGuid: string, termSetName: string, showOnlyAvailableForTag: boolean) {
return new Promise((resolve, reject) => {
const termSetDataCacheExpiresMin: number = 1440;
const termSetDataCacheKey: string = "TermSetData_" + termSetName + termSetGuid;
const termSetDataCache: any = Cache.getStoredDataByKey(termSetDataCacheKey);
Function _getSelectControl
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private _getSelectControl(async: boolean, minimumInput?: number) {
const { placeholder, name, multi } = this.props;
const { options, value } = this.state;
return async ? (
<Select.Async
Function getTermSetCount
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static getTermSetCount(termSetGuid: string, termSetName: string) {
return new Promise((resolve: any, reject: any) => {
const termSetCountCacheExpiresMin: number = 10080;
const termSetCountCacheKey: string = "TermSetCount_" + termSetName + termSetGuid;
const termSetCountCache: any = Cache.getStoredDataByKey(termSetCountCacheKey);
Function getStoredDataByKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public static getStoredDataByKey(key: string): any {
let returnData: any = null;
if (window.sessionStorage) {
const newKey: string = Cache.buildStorageKey(key);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"