  We consider the critical spin-spin correlation function of the 2D Ising model
with a line defect which strength is an arbitrary function of position. By
using path-integral techniques in the continuum description of this model in
terms of fermion fields, we obtain an analytical expression for the correlator
as functional of the position dependent coupling. Thus, our result provides one
of the few analytical examples that allows to illustrate the transit of a
magnetic system from scaling to non-scaling behavior in a critical regime. We
also show that the non-scaling behavior obtained for the spin correlator along
a non-uniformly altered line of an Ising model remains unchanged in the
Ashkin-Teller model.
