Showing 1,278 of 4,906 total issues
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;
const pinned = !!columnId;
const emptyMessage = <FormattedMessage id='empty_column.favourited_statuses' defaultMessage="You don't have any favorite posts yet. When you favorite one, it will show up here." />;
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl, accountIds, hasMore, multiColumn, locked, domain, isLoading } = this.props;
const emptyMessage = <FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />;
const unlockedPrependMessage = !locked && accountIds.size > 0 && (
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;
const pinned = !!columnId;
const emptyMessage = <FormattedMessage id='empty_column.bookmarked_statuses' defaultMessage="You don't have any bookmarked posts yet. When you bookmark one, it will show up here." />;
Function _toggleZoom
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_toggleZoom () {
const { scale, zoomMatrix } = this.state;
if ( scale >= zoomMatrix.rate ) {
this.setState({
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { category, startedFrom, rules, intl } = this.props;
const options = rules.size > 0 ? [
'spam',
Function renderAdminReport
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
renderAdminReport (notification, account, link) {
const { intl, unread, report } = this.props;
if (!report) {
return null;
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl, accountIds, hasMore, multiColumn, locked, domain, isLoading } = this.props;
const emptyMessage = <FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />;
const unlockedPrependMessage = !locked && accountIds.size > 0 && (
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl, columnId, hasUnread, multiColumn, onlyMedia, onlyRemote } = this.props;
const pinned = !!columnId;
return (
Function _toggleZoom
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_toggleZoom () {
const { scale, zoomMatrix } = this.state;
if ( scale >= zoomMatrix.rate ) {
this.setState({
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render () {
const { intl, hasUnread, columnId, multiColumn, onlyMedia } = this.props;
const pinned = !!columnId;
return (
Method call
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def call(statuses, **options)
ActiveRecord::Associations::Preloader.new(
records: statuses,
associations: options[:skip_side_effects] ? :reblogs : [:account, :tags, reblogs: :account]
).call
Method rewrite
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def rewrite
if @tree.nil?
src = text.gsub(Sanitize::REGEX_UNSUITABLE_CHARS, '')
@tree = Nokogiri::HTML5.fragment(src)
document = @tree.document
Method call
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def call(uri, prefetched_body: nil, on_behalf_of: nil, expected_actor_uri: nil, request_id: nil)
return if domain_not_allowed?(uri)
@request_id = request_id || "#{Time.now.utc.to_i}-status-#{uri}"
@json = if prefetched_body.nil?
Function useTimeout
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useTimeout = () => {
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
const callbackRef = useRef<() => void>();
const set = useCallback((callback: () => void, delay: number) => {
Function useTimeout
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const useTimeout = () => {
const timeoutRef = useRef<ReturnType<typeof setTimeout>>();
const callbackRef = useRef<() => void>();
const set = useCallback((callback: () => void, delay: number) => {
Function withOptionalRouter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function withOptionalRouter<
ComponentType extends React.ComponentType<OptionalRouterProps>,
>(Component: ComponentType) {
const displayName = `withRouter(${Component.displayName ?? Component.name})`;
const C = (props: React.ComponentProps<ComponentType>) => {
Method remove
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def remove
fail_with_message '--prune-profiles and --remove-headers should not be specified simultaneously' if options[:prune_profiles] && options[:remove_headers]
fail_with_message '--include-follows can only be used with --prune-profiles or --remove-headers' if options[:include_follows] && !(options[:prune_profiles] || options[:remove_headers])
time_ago = options[:days].days.ago
Method initialize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(path, max_frames = 2)
@path = path
@nb_frames = 0
File.open(path, 'rb') do |s|
Function withOptionalRouter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function withOptionalRouter<
ComponentType extends React.ComponentType<OptionalRouterProps>,
>(Component: ComponentType) {
const displayName = `withRouter(${Component.displayName ?? Component.name})`;
const C = (props: React.ComponentProps<ComponentType>) => {
Function buildSearch
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
const buildSearch = (data) => {
const search = [];
let addToSearch = (strings, split) => {
if (!strings) {
- 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"