def location_from_range(range) # rubocop:disable Metrics/AbcSize
      length = if range.start_pos.line == range.end_pos.line
                 range.end_pos.offset - range.start_pos.offset
               else
                 line_source = engine.lines[range.start_pos.line - 1]
                 line_source.length - range.start_pos.offset + 1
               end

      # Workaround for https://github.com/sds/scss-lint/issues/887 to acount for
      # https://github.com/sass/sass/issues/2284.
      length = 1 if length < 1

      Location.new(range.start_pos.line, range.start_pos.offset, length)
    end
def location_from_range(range) # rubocop:disable Metrics/AbcSize
      length = if range.start_pos.line == range.end_pos.line
                 range.end_pos.offset - range.start_pos.offset
               else
                 line_source = engine.lines[range.start_pos.line - 1]
                 line_source.length - range.start_pos.offset + 1
               end

      # Workaround for https://github.com/sds/scss-lint/issues/887 to acount for
      # https://github.com/sass/sass/issues/2284.
      length = 1 if length < 1

      Location.new(range.start_pos.line, range.start_pos.offset, length)
    end
Extract {SCSSLint::Location} from a {Sass::Source::Range}.

 @param range [Sass::Source::Range]
 @return [SCSSLint::Location]