Showing 445 of 2,739 total issues
Function FileSelector
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
const FileSelector = React.forwardRef((props, ref) => {
const {
className,
style,
id,
- 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"
Further reading
Function Hex
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Hex() {
const { hex, tabIndex, onChange } = useContext(ColorPickerContext);
const [color, setColor] = useState(hex.substr(1));
const [isFocused, setIsFocused] = useState(false);
Function Messages
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Messages = props => {
const { className, style } = props;
return (
<svg
className={className}
Function FolderOpen
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const FolderOpen = props => {
const { className, style } = props;
return (
<svg className={className} style={style} width="20px" height="15px" viewBox="0 0 20 15">
<g id="components" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
Function Comments
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Comments = props => {
const { className, style } = props;
return (
<svg
className={className}
Function Week
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Week(props) {
const { week, events, onEventClick, onScroll, locale } = props;
function Days() {
return Array.from(Array(7), (_value, index) => {
Function ErrorIcon
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function ErrorIcon() {
return (
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1">
<g id="components" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g
Function AvatarExample
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function AvatarExample() {
return (
<div>
<Avatar
className="rainbow-m-horizontal_medium"
Function PageButtons
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function PageButtons(props) {
const { pages, activePage, onChange, variant } = props;
const getAriaCurrent = page => {
if (page === activePage) {
Function useOptions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function useOptions(props) {
const {
currency,
currencyDisplay,
currencySign,
Function Edit
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Edit(props) {
const { className, style } = props;
return (
<svg
width="14px"
Function Calendar
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Calendar(props) {
const { locale, selectionType, variant, value, onChange, ...rest } = props;
const currentLocale = useLocale(locale);
const currentValue = useCurrentDateFromValue(value);
const range = useRangeFromValue(value, selectionType);
Function constructor
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
constructor(props) {
super(props);
this.state = {
hour: getHour(props.value),
minutes: getMinutes(props.value),
Function Month
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Month(props) {
const { firstDayMonth, selectedDate, minDate, maxDate, onSelectDate } = props;
let date = new Date(firstDayMonth);
const lastDayMonth = useMemo(() => getLastDayMonth(firstDayMonth), [firstDayMonth]);
const weeks = [];
Function Week
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function Week(props) {
const {
selectedDate,
startDate,
endDate,
Function CheckmarkIcon
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function CheckmarkIcon(props) {
const { className, style } = props;
return (
<svg
className={className}
Function buildPlainListFromTree
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function buildPlainListFromTree(tree, parentName, parentPath) {
if (!Array.isArray(tree)) return [];
return tree.reduce((result, node, index) => {
const nodeName = getNodeName({ parentName, index });
const level = getNodeLevel({ name: nodeName });
Function Color
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const Color = React.forwardRef((props, ref) => {
const { color, name, tabIndex, isChecked, onChange } = props;
const rgba = colorToRgba(color);
const colorId = useUniqueIdentifier('color-picker-default');
if (!isValidColor(rgba)) {
Function DoneIcon
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function DoneIcon(props) {
const { className, style } = props;
return (
<svg
className={className}
Function CountriesList
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const CountriesList = memo(props => {
const { countries, country, itemsRef, handleCountryChange, handleActiveChange } = props;
const list = useSimulatedLoading(countries, 15);
return list.map((value, index) => {